Even while it has been accused of providing financial and material support for Mr. Assad’s crackdown, Iran has increased calls for Syria to end the violence and reform its political process, a formula Tehran apparently hopes will repair its image and, if heeded, possibly bolster Mr. Assad’s standing.

“Regional nations can assist the Syrian people and government in the implementation of essential reforms and the resolution of their problems,” Mr. Ahmadinejad said in an interview in Tehran, according to his official Web site. Other press accounts of the interview with a Portuguese television station quoted him as also saying, “A military solution is never the right solution,” an ironic assessment from a man whose own questionable re-election in 2009 prompted huge street demonstrations that were put down with decisive force.

The collapse of the Assad government would be a strategic blow to Shiite-majority Iran, cutting off its most important bridge to the Arab world while empowering its main regional rivals, Saudi Arabia and its increasingly influential competitor, Turkey, both Sunni-majority nations. Iran would also lose its main arms pipeline to Hezbollah in Lebanon, further undermining its ambition to be the primary regional power from the Levant to Pakistan.

Not long ago, Iran and its Arab allies like Hezbollah’s leader, Hassan Nasrallah, were seen as folk heroes to many Arabs for their confrontational stance toward the United States and Israel.

But Iran has suddenly found itself on the wrong side of the barricades.

“Assad’s heroic image of resistance is being watered down,” said Vali Nasr, a professor at Tufts University and the author of “The Shia Revival: How Conflicts Within Islam Will Shape the Future.” “That’s the problem for Iran and for Hezbollah. They are trying to find out how to have their cake and eat it, too.”