Something unpredictable happened in Poland and Lech Walesa's march to that country's presidency. The voters pulled off a surprise.

In putting democracy to the test for the very first time in a vote for president, Walesa, the favorite, failed to get the 50 percent needed for an outright victory. A runoff will be needed. The biggest surprise was who finished second.Stanislaw Tyminski, a 42-year-old political unknown who has spent the last 21 years in Canada and Peru, was a strong runner-up. The sitting prime minister, Tadeusz Mazowiecki, was a humiliating third.

Mazowiecki, predicting chaos, resigned as prime minister, leaving that important post empty.

The stunned Walesa, a shipyard electrician who as Solidarity leader marshaled the forces that ended four decades of communist rule, threatened to withdraw from the race rather than face a second round against an unworthy opponent on Dec. 9.

Tyminski, an unabashed carpetbagger who obviously posseses more nerve than good sense, brashly promised to win and to improve the economy within a month - in fact to make it "rich and prosperous."

That will be a good trick in a country plagued with poverty and hunger.

His political success generated shock among many. Critics questioned Tyminski's qualifications, his Canadian and Peruvian citizenships, his business dealings, his leadership of the fringe Libertarian Party of Canada, and even his mental stability.

Some said the election result was a dangerous phenomenon emanating from stupidity and a lack of experience in democracy. Yet it is true that democracy always provides for built-in surprises.

Polish election law, drafted in the year since communism was toppled, allowed any candidate who could gather 100,000 signatures to appear on the ballot. The one thing it did not require was that a candidate live in Poland.

The election, Poland's first popular presidential vote, was the first in Eastern Europe to focus not on defeating communism but on choosing between visions for the post-communist future.

The Polish have discovered that elections by the popular will are far different from allowing Parliament to choose presidents. During the first month of campaigning, Tykminski was not treated as a serious contender, thus escaping media scrutiny and criticism from rivals.

Walesa and Mazowiecki concentrated on each other, allowing the dark horse to gain points by making strong accusations. Apparently, a number of voters were enticed by what seemed like a clean candidate not soiled by the bickering of the two members of Solidarity.

Such is democracy. Providing Walesa is wise enough to stay in the race, he has an opportunity to capitalize on Tyminski's weaknesses in the second round. It isn't the first time a candidate for office in a democracy underestimated his opponent - and it won't be the last.