Iran's supreme leader may have helped Mahmoud Ahmadinejad to win two presidential elections, but he is now bent on stopping his turbulent protege from levering his own man into the job.
There was a time when even reformist presidents would defer to Ayatollah Ali Khamenei as the ultimate authority in the Islamic Republic's clerical system. Ahmadinejad changed all that.
Ahmadinejad's relentless quest for power and recognition has led him into direct confrontation with Khamenei, the man to whom he arguably owes his second term, if not his first.
And as Iran's first non-clerical president since 1981, he has not stopped short of challenging the power of the clergy.
Even though he cannot stand for a third term, Ahmadinejad is widely seen as determined to extend his influence by backing his former chief of staff Esfandiar Rahim Mashaie for president.
Khamenei loyalists accuse Mashaie of inspiring a 'deviant' trend that favors strong nationalism over clerical rule.
"So magical is the political prowess attributed to Mashaie and Ahmadinejad's populist appeal that Mashaie's prospective candidacy causes much concern in the Khamenei camp,'' said Shaul Bakhash, professor at George Mason University in the United States, weighing prospects for the election in mid-June.
Voters, preoccupied by bread-and-butter issues in an economy battered by Western sanctions imposed over Iran's nuclear program, may only have conservatives from which to choose.
Reformists are unlikely to get a look. Mir-Hossein Mousavi and Mehdi Karoubi, who ran against Ahmadinejad in a 2009 election that they denounced as rigged, languish under house arrest.
The reformist movement "has no organizational capacity and no recognised candidate right now," said Scott Lucas of EA worldview, a news website that monitors Iranian media.
Iran's rulers, keen to avert any repeat of the mass protests and violence that shook Iran after the 2009 poll, will try to ensure that only obedient candidates pass the vetting process.
And to block Mashaie or any other pro-Ahmadinejad candidate, Khamenei is turning to a three-man alliance of principalists - hardliners loyal to him - to unite behind one candidate to secure a quick and painless election win, say diplomats and analysts.
The driving force behind this appears to be the supreme leader's foreign policy adviser Ali Akbar Velayati, who is one of the three possible contenders, along with Tehran mayor Mohammad Baqer Qalibaf and lawmaker Gholam Ali Haddad Adel.
"If principalists are divided... and the presidency is not in the hands of principalists in the future, we will have a tragedy," Velayati said last month. "From these three people one person will be introduced as a candidate, so we can finish the job in the first round."
Analysts agree that Khamenei, deeply concerned about the election outcome, has given the nod to the initiative.
"Ayatollah Khamenei has systematically and effectively concentrated both power and authority in his person. No one in Iran today can become president without his approval,'' said Ali Ansari, an Iran scholar at St Andrew's University in Scotland.
Velayati appears to be leading a drive to eradicate Ahmadinejad's power and unite all principality's behind a single candidate - despite their own virulent political divisions.
A U.S.-trained doctor who served as foreign minister for 16 years until 1997, Velayati is now regarded as one of Khamenei's most influential advisers, often deployed to carry out high-level initiatives on the leader's orders.
Velayati's partners in the anti-Ahmadinejad alliance are established politicians, but less well known abroad.
Haddad Adel is the father-in-law of Khamenei's third son, Mojtaba, the gate-keeper of access to the leader himself. An MP and former parliament speaker, he commands influence in the assembly and much respect for his academic credentials. His family ties to Khamenei have strengthened his position within the leader's inner circle, but have opened him up to accusations that he is little more than a pawn of the leader.
The third member of the trio, Mohammad Baqer Qalibaf, is a former commander of Iran's elite Revolutionary Guards [IRGC]. He is regarded as a pragmatist who "reaches out to more moderate conservatives," said Scott Lucas of EA World view.
Popular, charismatic and boasting support from the Guards, Qalibaf's inclusion in the alliance may be intended to stifle any threat he might pose by running as an independent candidate.
"He is too popular in his own right and may represent IRGC constituencies that the supreme leader is nervous about," said a European diplomat who focuses on Iran policy.
Khamenei can tighten his grip on the poll via the Guardian Council, which can veto candidates - although barring too many would risk destroying public interest in a vote which, however circumscribed, bolsters Iran's claims to democratic legitimacy.
"Without these elections and high participation, even the pretence of democracy would fall apart," said Trita Parsi of the Washington-based National Iranian American Council.
Allowing an Ahmadinejad-backed contender - or dark-horse independents - to run has risks, though, for the ruling establishment.
"Ahmadinejad has shown he isn't going quietly," said the European diplomat. "The danger will be if his candidate doesn't get in amid voter fraud speculation - then we've got a 2009 situation, involving regime insiders."
Tensions already are rising. Last month Parliament Speaker Ali Larijani - also a principalist - was pelted with shoes and stones by Ahmadinejad supporters in the holy city of Qom, where he had come to make a speech on the 34th anniversary of Iran's revolution.
It was the latest skirmish in a personal feud that had exploded into public days earlier when the president accused Larijani's family of using its position for economic gain. Larijani's brother, Fazel, described Ahmadinejad's behavior as a conspiracy carried out by "Mafia-like individuals."
Such public wrangling among Iran's conservative political elite is an embarrassment to the Supreme Leader.
"Khamenei no longer seems able to impose discipline eve among his own lieutenants when it comes to those fierce political rivalries," said Bakhash.
Among independents to throw their hats in the ring are former Foreign Minister Manouchehr Mottaki and former IRGC commander Mohsen Rezaie, a losing candidate in 2009. Both are conservatives who could disrupt Velayati's campaign to close ranks for Khamenei and shut out any Ahmadinejad proxy.
A president loyal to Khamenei might prove slightly less adversarial than Ahmadinejad in relations with the West, but would still be unlikely to accept a major nuclear compromise.
"Since they are beholden to the supreme leader, I can't see much change other than a reduction in some of the rhetoric," said Ansari of St Andrew's University. "Although this would help, at least on a superficial level."