The violent night left in doubt the next step for Belarus, which is of interest to the Kremlin because of its position as a buffer between Russia and the West. The West, for its part, has been offended by Lukashenko's harsh rule and his resistance to change.
Three of the candidates who ran against Lukashenko were arrested and the top opposition leader, Vladimir Neklyayev, was forcefully taken from the hospital by unknown men in civilian clothes, activists said.
Neklyayev's aide said seven men wrapped Neklyayev in a blanket on his hospital bed and carried him outside as his wife screamed, locked in a neighboring room. His whereabouts are currently unknown. Neklyayev and two other candidates were severely beaten in clashes with government forces.
The demonstration and its violent end all happened even before preliminary results were announced. But opposition supporters were convinced that Lukashenko would fake the tally. In previous elections, none of which were judged free and fair by Western observers, Lukashenko tallied 80 percent or more.
This year's election had given tantalizing hints that the repressive political climate might be changing in the ex-Soviet state. Not only were nine candidates allowed to challenge Lukashenko, they were even given unprecedented access to state broadcast media to conduct debates.
But if Lukashenko had been looking, or trying to look, like he was flirting with democracy, the romance was clearly over within three hours of the polls closing.
The crowd that gathered in central Minsk, estimated by the opposition at tens of thousands, was significantly larger than protesters who massed after the 2006 elections. But those protests were allowed to go on sporadically for a week; Sunday's didn't make it until midnight.
As riot police beat on their shields to drive the crowd away from the government offices, the defiant crowd matched the rhythmic blows with the chant "We will come back." However, it was unclear how long such bravado could last in the face of harsh crackdowns.
"Repression and arrested have stopped the wave of protests," said candidate Yaroslav Romanchuk. "Street democracy is over."
But anger remains high.
"We had a peaceful protest and it is the authorities who used force," said Marat Titovets, a 40-year-old engineer. "After Lukashenko spilled blood, he cannot remain in power."
Protesters broke windows and glass doors of the government building, which also houses the Central Election Commission, but they were repelled by riot police waiting inside. Hundreds more riot police and Interior Ministry troops then arrived in trucks and sent most of the demonstrators fleeing. Some tried to hide in the courtyards of nearby apartment buildings, but were bludgeoned by troops waiting inside the courtyards.
Neklyayev was beaten by riot police while leading a few hundred of his supporters to the demonstration and was taken by ambulance to a hospital, according to his wife. His left eye was bruised, his nose was bleeding and he was nauseous and unable to speak, Olga Neklyayeva told the Associated Press.
Another opposition candidate, Vitaly Rymashevsky, was beaten in clashes with riot police by the government building. He claimed that the people who attempted to storm the building were police acting as demonstrators and that he was attacked when he tried to stop them.
After the polls closed, thousands of opposition activists converged as planned on October Square, but most of the square had been flooded to make an ice skating rink and pop music boomed from loudspeakers.
The protesters then set off along the main avenue toward Independence Square, where the main government building is located.
The demonstrators shouted "leave" to Lukashenko, who has led Belarus since 1994 in a heavy-handed regime that is often characterized as the last dictatorship in Europe.
"Belarusians have shown that they want freedom and cannot tolerate the current regime," opposition leader Yaroslav Romanchuk said.
Russia and the European Union are closely monitoring the election, having offered major economic inducements to tilt Belarus in their direction.
Signs that Lukashenko is leaning toward the West would be a moral victory for countries that have long criticized his harsh rule and worried about his connections with vehemently anti-West regimes. For Russia, a return to the fold would bolster Moscow's desire to remain the power-broker in former Soviet regions.
In casting his ballot, Lukashenko expressed confidence that he would win a fourth term. He denounced the planned opposition rally as being led by "bandits and saboteurs" and proclaimed that it would not take place.
"Don't worry, nobody is going to be on the square tonight," Lukashenko said while voting with his 6-year-old son, Kolya.
But tens of thousands turned out.
"How can we counter a dictator who created a police state in the past 16 years?" said 21-year-old student Artur Makayonak, who was among the activists heading to the square. "Only our protests, our strive for freedom and a peaceful rally."
Opposition candidates and rights activists said five senior campaign workers and 27 opposition activists have been detained since Saturday. Police refused to comment.
Neklyayev had condemned the detentions.
"When the representatives of one of the candidates get arrested on the orders of another candidate, that cannot be called an election," he said.
Nearly a quarter of the 7 million registered voters went to the polls in five days of early voting last week, according to the Central Election Commission. The opposition and election observers say early voting allows for ballot stuffing as boxes are poorly guarded and voting precincts are poorly monitored.
Lukashenko, a 56-year-old former collective firm manager, maintains a quasi-Soviet state in the country of 10 million, allowing no independent broadcast media, stifling dissent and keeping about 80 percent of the industry under state control.
Although once seen as almost a lapdog of Russia, Lukashenko in recent years has quarreled intensively with the Kremlin as Russia raised prices for the below-market gas and oil on which Belarus' economy depends.
However, his tone changed this month after Russia agreed to drop tariffs for oil exported to Belarus - a concession worth an estimated $4 billion a year.
But Lukashenko also is working to curry favor with the West, which has harshly criticized his years of human rights abuses and repressive politics. Last week, he called for improved ties with the U.S., which in previous years he had cast as an enemy.
The European Union, eager to see reforms in the obstreperous country on its borders, has offered euro3 billion ($3.9 billion) in aid to Belarus if the elections are judged to be free and fair. The prospects of such a judgment and payout seem remote, however, analysts said.
Maria Danilova in Minsk contributed to this report.