Iran's President Mahmoud Ahmadinejad walks past a portrait of Iran's Supreme Leader Ayatollah Ali Khamenei as he arrives at a news conference in Istanbul, Turkey, on Monday, May 9. Ahmadinejad is in Istanbul to attend the 4th United Nations Conference on the Least Developed Countries.

Iran’s President Mahmoud Ahmadinejad has survived one of the most turbulent political storms of his seven-year presidency, a stand-off with Iran's supreme religious leader that caused some to believe he would be impeached or forced to resign as early as this past weekend.

But Mr. Ahmadinejad arrived in Istanbul today for an international conference as planned, after accusing political enemies of dirty tricks and brushing off his weeks-long defiance of Ayatollah Ali Khamenei. At issue was a tussle over the key post of the Intelligence minister and the powerful role of Ahmadinejad's chief of staff and in-law, Esfandiar Rahim Mashaie.

The feud drew a rare public rebuke of Ahmadinejad from Khamenei, whose unqualified support of the president’s disputed reelection victory in June 2009 – Khamenei called it a “divine assessment” – ensured that Ahmadinejad stayed in the post and set the tone for a brutal crackdown on pro-democracy protests.

The political turmoil is likely to extend far beyond the current spat to parliamentary elections next year and the presidential vote slated for 2013.

“Both Ahmadinejad and Khamenei have been damaged, because what has become evident [is] that Ahmadinehad was genuinely trying to encroach on the powers of the supreme leader,” says Mehrdad Khonsari, an Iranian analyst and critic of the government who is based in London. “Ahmadinejad couldn’t carry the day and that’s why he backed down.”