The unprecedented power struggle between the two most powerful leaders in Iran deepened Friday, spilling out into Tehran’s public prayers where the mullah leading the service indirectly criticized President Mahmoud Ahmadinejad while the crowd chanted “Death to opponents of the supreme leader!”

The split started about two weeks ago after the president tried to dismiss the head of the intelligence ministry, the powerful government branch that exerts widespread control over domestic life. Ayatollah Ali Khamenei, the supreme leader, ordered that the minister, Heydar Moslehi, keep the post.

Mr. Ahmadinejad then stayed home for 11 days, according to reports from Iran, engaging in a visible fit of pique that threatened to undermine the staunch alliance the two had forged since Mr. Ahmadinejad was first elected president in 2005.

The spat dragged into the open several factional fights, analysts said, particularly the efforts by Mr. Ahmadinejad’s conservative opponents to prevent his faction from dominating the parliamentary elections next March and even the presidential vote in 2013.