Ahmadinejad has angered Khamenei with his repeated attempts to gain more power within the Iranian political system and to act unilaterally. In response, Khamenei has launched a campaign to weaken the combative president.

Last Friday's incident at Khomeini's mausoleum was just another warning to Ahmadinejad to surrender to Khamenei's will or face more attacks.

For now, Ahmadinejad doesn't seem intimidated or ready to compromise with Khamenei, who as Supreme Leader has the last say in all state matters and is politically above the president, not his rival.

The power struggle between the two first heated up in April when Ahmadinejad dismissed Intelligence Minister Heydar Moslehi, apparently over his surveillance of presidential confidant and then-Chief of Staff Rahim Mashaei. It wasn't the first time Ahmadinejad had acted without consulting the Iranian leader.

Khamenei, who has a long record of reacting poorly when challenged, and who would have reason to oppose Mashaei for his more moderate views, was quick to react. In a public letter, he reinstated Moslehi, a slap to Ahmadinejad.

Ahmadinejad accepted Moslehi back to his team only after publicly sulking and refusing to attend cabinet meetings for almost two weeks. It was when he finally came back to work that he began creating even more problems.

Ahmadinejad merged eight ministries into four, despite widespread opposition against the erratic, and declared himself in charge of the crucial Oil Ministry. This renewed a long-running fight between him and the Parliament, which said the move violated Iranian laws. One day after Parliament reported his "illegal action" to the Judiciary, Ahmadinejad appointed a caretaker.

Parliament's vote to notify the Judiciary highlights how isolated Ahmadinejad has become: only one lawmaker opposed the bill. He's lost political support elsewhere as well, including among some of his former loyalists. The most important of those is the ultra-hardline Ayatollah Mesbah Yazdi. In 2005, Mesbah Yazdi declared Ahmadinejad's election a miracle and a gift from the Hidden Imam. Now, he calls Ahmadinejad's entourage "garbage" and says publicly that the president has been bewitched.

Several commanders of the Iranian Revolutionary Guard Corps, which is through to have played a key role in Ahmadinejad's disputed 2009 reelection, have also publicly denounced the president's political clique while vowing allegiance to the supreme leader.

In one of the latest attacks, Khamenei's deputy representative to the Revolutionary Guard, Mojtaba Zolnour, described Ahmadinejad's inner circle as the gravest danger in the history of Shiite Islam and said that it would weaken the foundation of the Islamic Republic. Not long ago, publicly using such terms against Ahmadinejad, once Khamenei's protégé, would have been unthinkable. But these days, they are considered normal rhetoric in Tehran.