After the huge protests that followed the 2009 election, Iran's Supreme Leader Ayatollah Ali Khamenei may have hoped June polls would quietly install a loyal conservative president, but the surprise candidacies of two major independents may scupper that.
Both Esfandiar Rahim Mashaie, the nationalist protégé of rabble-rousing President Mahmoud Ahmadinejad, and Akbar Hashemi Rafsanjani, a former president and Iran's best known political grandee, are seen as a threat to the leader's authority.
Khamenei personally intervened to block Mashaie becoming vice-president in 2009 - such was his disapproval of a man conservatives accuse of leading a "deviant current" within Islam that seeks to undermine the power of Muslim clerics.
Meanwhile, the supreme leader's rivalry with Rafsanjani, a seasoned political operator, goes back decades.
Little can be predicted at this stage but if Mashaie makes it through the vetting process, the election on June 14 could turn into a three-horse race between him, Rafsanjani and one of several "Principlist" candidates - those who are fiercely loyal to Khamenei and the principles of the Islamic Republic.
Even if they fail to win, big-name alternative candidates could attract greater public interest in the election, making Khamenei's plan to see an obedient conservative take office a great deal more difficult, despite his ultimate power and the Revolutionary Guards who back him.
Struggling with sanctions over its disputed nuclear program and embroiled in civil war in Syria, one of its few and closest allies, Iran's leadership must be keen to show the world it has a strong, harmonious, fully functioning political system.
Instead, the race may produce drama and perhaps the unexpected.
The contest not only reprises Rafsanjani's fight with Ahmadinejad's camp, which beat him to the presidency in 2005, but also brings into focus his troubled relationship with Khamenei, which disintegrated over his support for the defeated reformist opposition in 2009.
"Rafsanjani poses a challenge. He has said he wants to save the Islamic Republic by changing the hardline direction the country has taken in the past few years," said Farideh Farhi, an Iran analyst at the University of Hawaii.
"Principlists who have not been able to come up with a candidate that brings together all their competing wings will have to scramble in search of some sort of unity," she said.
As president between 1989 and 1997, Rafsanjani clashed with Khamenei and hardliners over his pragmatic plans to mend relations with regional states and liberalize Iran's economy.
But it was support for the reformist "Green Movement" protests against Ahmadinejad's disputed 2009 election win that cast him out in the cold.
Last week, Rafsanjani said he would not enter the fray without Khamenei's consent. But analysts say a last-minute agreement with the supreme leader may not have been the ringing endorsement the former president was looking for. "Khamenei can see this as a personal challenge or a means to enhance the legitimacy of the system as a whole," said Farhi.
Khamenei may also be unable to rein in conservatives and the powerful Islamic Revolutionary Guard Corps, which wields both political and economic influence, from going on the attack. Rafsanjani is in some ways an easy target.
"Rafsanjani's wealth and business dealings present a huge vulnerability," said Shaul Bakhash, a politics professor at George Mason University in Virginia.
"Since Khamenei can't really control them, the conservative establishment, its clerical associates and the Revolutionary Guards are certain to mount a massive campaign against him."
A "DEVIANT" CAMP
The line-up also breathes new life into a seething squabble between Khamenei and Ahmadinejad, who has repeatedly challenged the authority of the supreme leader and only narrowly avoided being forced from office.
Tied to Ahmadinejad by the marriage of his daughter to the president's son, Mashaie is viewed with intense distrust and dislike by those unswervingly loyal to Khamenei.
Given the leader's own evident distaste for Mashaie, the fact that he even registered as a candidate amounts to a direct challenge to the authority of Khamenei.
Mashaie has inserted himself into religious debates and emphasized Iranian nationalism in his speeches - behavior that has outraged traditionalists.
But the Guardian Council, a conservative body of clerics and jurists that vets candidates, looks unlikely to approve Mashaie, analysts said, leaving Ahmadinejad and his allies with few options left to maintain influence and perhaps even their liberty once the current president's term ends.
"The cards are usually stacked against those who dare to challenge the Guardian Council's decision," said analyst Yasmin Alem, an expert on Iran's electoral system. "There's no reason to believe that this time will be any different."
But Ahmadinejad has shown himself capable in the past year of striking out at his political enemies, a prospect that could prove highly damaging to the Islamic Republic and its leader.
Ahmadinejad has said he has a wealth of potentially damaging information on a number of establishment figures.
"The question is whether Ahmadinejad will fulfill his threat to release all sorts of tapes of secret conversations and corruption. Releasing this will be something of a double-edged sword," said Ali Ansari of St Andrew's University in Scotland.
Meanwhile, the Principlist coalition has lost its early momentum.
Two months ago the alliance - comprising charismatic Tehran Mayor Mohammad Baqer Qalibaf, former foreign minister Ali Akbar Velayati and Gholam-Ali Haddad-Adel, a former parliamentary speaker and adviser to Khamenei - was the most definite player in the contest.
The group now looks set to back Saeed Jalili, a hardline conservative war veteran who is seen as close to Khamenei and has led rounds of nuclear talks with world powers since 2007.
That in itself poses another problem for Khamenei, should he give his backing to Jalili, who lacks executive experience, said Farhi of the University of Hawaii.
"He (Khamenei) will again be accused of allowing inexperienced folks to take the executive helm of the country and economy in times of serious economic crisis," she said.