Iran's president and his one-time champion, the Islamic republic's supreme leader and absolute ruler, Ayatollah Ali Khamenei, have ended a battle of wills.
Iran's president ends political spat
It was a political spat over a ministerial resignation that soon turned into a full-blown political crisis.
It locked Iran's president, Mahmoud Ahmadinejad, and his one-time champion, the Islamic republic's supreme leader and absolute ruler, Ayatollah Ali Khamenei, in an escalating battle of wills.
But yesterday Iran's headstrong president seemingly bowed to the inevitable in what appeared to be a humiliating climbdown.
With no desire to eat humble pie in public, Mr Ahmadinejad, who usually loves television cameras, avoided facing the media. But he was quoted by his cabinet's "ethics teacher" as saying: "All of us should support and follow the supreme jurisprudent (Ayatollah Khamenei) until the end of our lives."
The damaging rift erupted in mid-April when Mr Ahmadinejad forced the resignation of Iran's intelligence minister, Heydar Moslehi, who isclose to the supreme leader.
Within hours, Ayatollah Khamenei showed his wayward president who was boss by reinstating Mr Moslehi, the only cleric in the cabinet.
In protest, Mr Ahmadinejad responded by boycotting two cabinet meetings and skipped an official visit to the holy city of Qom. His critics accused him of "sulking".
Most analysts believe that Mr Ahmadinejad had backed himself into a corner. He could not possibly win any power struggle against Iran's supreme leader, a wily if uncharismatic survivor, they argued.
Ayatollah Khamenei has the support of powerful clerics, the majority in parliament and the Revolutionary Guards.
Yesterday, Mr Ahmadinejad ended his nine-day boycott of official activities by chairing a cabinet session.
On Saturday, 216 conservatives out of parliament's 290 MPs called on the president to end his boycott of official duties for the good of the country, and to accept Mr Moslehi's reinstatement.
"You are expected to follow the supreme leader," the lawmakers chided Mr Ahmadinejad in a letter. Iran's enemies, they warned, are "taking advantage" of the dispute.
Powerful MPs had also called for a closed debate on the president's behaviour, tacitly raising the possibility of his impeachment, although that scenario was unlikely.
Mr Ahmadinejad, who has a reputation for stubbornness, was said to have been insisting on Mr Moslehi's removal before returning to work.
This was a red line for Ayatollah Khamenei.
Backing down would represent an irreparable lose of face for him. But as important, he wants a firm grip on the intelligence ministry because it is deeply involved in both Iran's international policies and its domestic spy networks that are pillars of the regime's control.
The ministry also plays a role in vetting candidates for elections. Mr Ahmadinejad and his conservative rivals are already jockeying for power ahead of parliamentary elections in March 2012 and a presidential vote a year later. These will shape Iran's course in what will be a very different Middle East.
Ayatollah Khamenei made a fateful decision in June 2009 when he gave his personal stamp of approval to the president's fiercely disputed re-election. Backed by the Revolutionary Guards, the supreme leader ensured that the pro-democracy Green movement, which contested the election result, was ruthlessly crushed.
But no sooner were Iran's reformists sidelined than deep rifts emerged within Iran's conservative camp, and the symbiotic relationship that tied Ayatollah Khamenei and Mr Ahmadinejad has come under increasing strain.
Fuelling friction has been Mr Ahmadinejad's ambition to monopolise power in his office at the expense of other institutions, such as parliament and the clergy.
"It is hard for Khamenei to let go of Ahmadinejad because be has invested so much in him. But Ahmadinejad is becoming more of a liability every day," said Meir Javedanfar, an Iranian-born Iran expert in Israel. "Khamenei must be asking himself whether he can sustain the damage this is causing to the Islamic republic for much longer," he said in a telephone interview.
A key irritant in relations between the rival conservative camps is a highly controversial and colourful character, Esfandiar Rahim Mashaei, the president's right-hand man, whom Mr Ahmadinejad is believed to be grooming as his successor.
Mr Mashaie is said to have sparked the current crisis when he pressed the president to force Mr Moslehi's resignation after the intelligence minister dismissed one of Mr Mashaie's own protégés.
Mr Mashaei, whose daughter is married to the president's son, is Mr Ahmadinejad's most cherished mentor: they have been close friends for a quarter of a century.
But Mr Mashaie is a red flag to most Iranian conservatives. He opposes greater clerical involvement in politics and has angered many with his nationalistic and unorthodox views championing Iran's pre-Islamic past.
He also infuriated conservatives in 2008 by suggesting that Iranians are "friends of all people in the world - even Israelis". And he once dismayed hardliners by allegedly watching unveiled women dancing at an Islamic tourism exhibition in Turkey.
"I hope that God will rid the president from the evil of this person," Ayatollah Khamenei's deputy representative in the Revolutionary Guards, Mojtaba Zolnour, was quoted as saying by various Iranian newspapers on Saturday.
After his fiercely disputed re-election in 2009, Mr Ahmadinejad appointed Mr Mashaie his first vice president. There was an angry outcry from Iranian conservatives and Ayatollah Khamenei ordered Mr Ahmadinejad to rescind the appointment. He complied - belatedly.
And, with characteristic defiance, he promptly made Mr Mashaie his chief of staff. For now, Iran's bruised president appears resigned to toeing the supreme leader's line. But given Mr Ahmadinejad's unruly record, few will rule out further spats.
"Ahmadinejad is fighting for his legacy," Mr Javedanfar said. "He'll be toothless if Mashaei can't go for the presidency."