Analysis: Row between Iranian leaders comes to a head
Iran's President, Mahmoud Ahmadinejad, has enjoyed taking on and defying the West. But he is now playing potentially a much more risky game.
Mr Ahmadinejad finds himself up against his own country's Supreme Leader, Ayatollah Ali Khamenei. The two men are currently engaged in an unusually public stand-off.
Their argument began on 17 April, when Mr Ahmadinejad decided to fire his Intelligence Minister, Heydar Moslehi. A simple decision, say the president's supporters, since the constitution gives him the right to dismiss ministers.
But, several hours later Ayatollah Khamenei decided to overrule the president and ordered the reinstatement of Mr Moslehi.
The Supreme Leader's supporters quote Article 110 of the constitution, which says that the leader is responsible for the "supervision over the proper execution of the general policies".
But Mr Ahmadinejad did not like being overruled. Reports say that he decided to stay away from government meetings for 11 days.
During this time, one of his aides, Ali Akbar Javanfekr, wrote on his blog that the president "is in pain, as if a thorn is stuck in his throat", adding: "He cannot take it out or swallow in."
A meeting on 25 April between the Supreme Leader and the president did not succeed in removing the thorn.
Mr Ahmadinejad did agree to start attending cabinet meetings again. But the status of the fired or reinstated minister, Heydar Moslehi, is not immediately clear.
Reports from Tehran say that Ayatollah Khamenei has now told Mr Ahmadinejad either to accept the reinstatement of his intelligence minister or step down as president.
The argument between the two men is about much more than the status of a single cabinet minister. Essentially, it is a fight for the control of the future direction of the Islamic Republic.
Mr Ahmadinejad cannot run for a third term as president in the 2013 election because the constitution has a two consecutive term limit. So instead, it seems that he is trying to promote the candidacy of his former chief of staff, Esfandiar Rahim Mashaei.
Mr Ahmadinejad and Mr Mashaei are close friends and even family; Mr Ahmadinejad's son is married to Mr Mashaei's daughter.
The Supreme Leader's circle believes that Mr Mashaei is the real power behind Mr Ahmadinejad.
"Currently Mashaei is the real president," said Hojjat ol-Eslam Mojtaba Zolnur, the Supreme Leader's representative in the Islamic Revolution Guards Corps (IRGC).
Analysts believe that Mr Mashaei wanted greater influence in the intelligence ministry - which is why his friend, the president, tried to fire the minister.
'Threat to clerics'
Why does this matter? Supporters of Mr Mashaei say that that he is promoting the slogan "Islam without clerics", which poses a threat to the clerical establishment led by the Supreme Leader.
The clerical establishment does not want to lose power to a combination of Mr Ahmadinejad and Mr Mashaei. That is why it has fought back against the pair.
In recent days, a number of people close to Mr Mashaei have been arrested.
Conservative members of parliament are keen to have their say. Most back the Supreme Leader against the president.
Some MPs are collecting the signatures that will allow them to question the president. But in recent years Mr Ahmadinejad has shown little inclination to listen to the parliament. He may not choose to do so now.
But defying the Supreme Leader is another matter. The 32-year history of the Islamic Republic shows that in any argument between the Supreme Leader and the president, the Supreme Leader always comes out ahead (a point proved by the frustrated presidency of Mr Ahmadinejad's reformist predecessor Mohammad Khatami).
Mahmoud Ahmadinejad now has to decide - back down, or continue to fight against a Supreme Leader who has recent history on his side.