Former president Akbar Hashemi Rafsanjani threw himself into Iran's election race on Saturday as a flurry of heavyweight candidates rushed to beat the registration deadline in the most unpredictable contest for decades.
Iranian media reported that Rafsanjani - a relative moderate - had registered for the June 14 presidential election with just minutes to spare. His candidacy radically alters what was previously seen as a contest between rival conservative groups.
The former president could scupper the hopes of 'Principlists', loyal to supreme leader Ayatollah Ali Khamenei, who are aiming to secure a quick and painless transition and paper over the deep fissures between the opposing camps.
Rafsanjani, 78, who was president from 1989 to 1997, is expected to draw some support from reformists because he backed the opposition movement whose protests were crushed after the last, disputed election in 2009.
The election comes at a critical moment, as Iran reels from international sanctions over its disupted atomic programme and faces the threat of attack by Israel if it crosses what the Jewish state calls a 'red line' towards acquiring a nuclear weapon.
Tehran strenuously denies it wants an atomic bomb.
A vast field of more than 400 candidates have thrown their names into the ring as potential successors to outgoing president Mahmoud Ahmadinejad, who has long been at odds with the supreme leader.
Shortly before Rafsanjani's announcement, Saeed Jalili, a hardline conservative who is seen as close to Khamenei and has led rounds of so far unsuccessful nuclear talks with world powers, entered his name as a candidate.
Soon afterwards Esfandiar Rahim Mashaie, an aide to Ahmadinejad and a man viewed with intense distrust by conservatives, registered for the race, gripping Ahmadinejad's hand as the two flashed peace signs for photographers.
Khamenei's camp sees Mashaie as leading a "deviant current" that seeks to set aside clerical influence in favour of a more nationalistic doctrine.
The presidential vote is the first since Ahmadinejad's disputed re-election four years ago, when mass "Green movement" protests erupted after the defeat of reformist candidates Mirhossein Mousavi and Mehdi Karoubi. Dozens were killed in the worst unrest since the 1979 revolution.
The outcome of next month's contest will signal the extent of Khamenei's control at the summit of power in the Islamic Republic.
It will also show whether he feels the need to reach out to opposition groups and whether the reformists are capable of making a comeback.
Proponents of greater social and political freedoms have been suppressed or sidelined: Mousavi, his wife and Karoubi have been under house arrest for over two years.
"So many wild cards"
After a day of intense speculation about his intentions, the last-minute entry by Rafsanjani was a moment of political drama. Iranian television showed him smiling and waving as he sat in the crowded office where he registered his candidacy.
"He knows if he runs he can have both the reformists' vote, and have some of the principlists. Rafsanjani is not the type to put aside power," said Mohammad Hossein Ziya, who campaigned for reformist Karoubi in 2009 and now edits Karoubi's website from the United States.
Another reformist ex-president, Mohammad Khatami, endorsed Rafsanjani on Friday.
"Rafsanjani is a pillar of the Islamic Revolution, whereas Khatami is a standard bearer of the reform movement," said Yasmin Alem, a US-based expert on Iran's electoral system.
"In the 2005 presidential poll, their constituencies competed against each other. But, since then, both have been marginalized and are now playing on the same side.
"With so many wild cards now in the game, the fate of the election is now concealed in a smoke screen."
The candidacy of Jalili promised to move the nuclear dispute to the forefront of the election campaign, and may also affect the tortuous negotiations between Iran and a six-power group consisting of the United States, Russia, China, Britain, France and Germany.
"In any scenario, Jalili's candidacy is likely to put nuclear diplomacy on hold for a while," said Ali Vaez, Iran analyst at the International Crisis Group.
"He can't pursue the nuclear talks and his electoral campaign simultaneously. And if he is elected president, there will be a learning curve for his successor."
Jalili is one of a host of Khamenei loyalists to put themselves forward, including charismatic Tehran Mayor Mohammad Baqer Qalibaf, former foreign minister Ali Akbar Velayati, and Mohsen Rezaie, who headed the Revolutionary Guards and lost to Ahmadinejad in 2009.
Ahmadinejad's vice-president Mohammad Reza Rahimi also registered on Saturday.
All candidates must be vetted by a conservative body of clerics and jurists known as the Guardian Council, which can disqualify any candidate without offering a justification.
It typically narrows the field to just a handful of men.
But there appears to be little of the popular enthusiasm that marked the run-up to the 2009 election, when many sensed a possibility of real change.
In comments gathered before Saturday's rush of developments, ordinary Iranians said they were more preoccupied with the economy than with political infighting.
"I only want to be able to feed and provide for my family. Anyone who can bring down inflation, create more jobs and lower rents will have my vote," said Majid, who works in a publishing company.
Clothing designer Sotoudeh, 32, said: "I won't vote at all, no matter who comes. They stole our vote four years ago and I see no point in voting now."