|While a soldier stands guard, a veiled Iranian woman under the gaze of religious posters casts her ballot in Ahvaz|
Ex-president Ali Akbar Hashemi Rafsanjani did not win the presidency outright, but secured enough votes to give him first place, and guarantee him one of the two spots in the runoff. But the big surprise - among many others in this election - was who he will face in the runoff.
In a stunning upset, Tehran mayor Mahmood Ahmadinejad, a hard-line conservative who was not considered in the top tier of candidates before the election, squeaked into second place and the runoff vote.
But third-place finisher Mehdi Karroubi, a reformist cleric, challenged that result. In an unprecedented public attack on election conduct in Iran, he accused Ahmadinejad supporters of vote-rigging and bribery and called for an investigation.
Asked about Mr. Karroubi's charges at a news conference, Mr. Ahmadinejad shrugged them off, saying Iran is a free country and Mr. Karroubi is entitled to his opinion.
The controversy was brewing as the votes were counted Saturday by Interior Ministry officials at the busy election central headquarters in Tehran.
Periodic tallies released throughout the day by the Interior Ministry showed Mr. Karroubi narrowly clinging to second place. But the Guardian Council, an unelected body of hard-line clerics that screens candidates and oversees the electoral process, at several points issued its own figures, showing Mr. Ahmadinejad in second place.
Outgoing President Mohammad Khatami said that, by law, only Interior Ministry figures are officially valid.
In the end, the official Interior Ministry results gave Mr. Ahmadinejad the second place finish and the runoff spot.
Mr. Ahmadinejad said both the Guardian Council and the Interior Ministry ensured what he called a clean election.
Reformers were deeply disappointed in the poor showing of their favorite, Mostafa Moin, who trailed fifth in the seven-candidate field.
Voter turnout was high, hovering at around 62 percent, compared with 51 percent four years ago. The turnout figure was cited by all candidates as a rebuff to those who had called for a boycott. They also cited it as an answer to President Bush, who just before the election, had criticized it as undemocratic. Some voters and candidates said Mr. Bush's remarks contributed to the higher turnout.