If one thing could scuttle Iranian President Hassan Rouhani's big plan - to fix Iran's economy by winning some relief from Western sanctions - a U.S. strike on Tehran's ally Syria is it.
Rouhani's June election landslide won him the cautious backing of Supreme Leader Ayatollah Ali Khamenei to pursue his pledge to engage with Western countries and attempt to ease Iran's isolation over Tehran's nuclear programme.
But the hardliners Rouhani defeated at the polls still dominate parliament and the powerful Islamic Revolutionary Guard Corps (IRGC), and are poised to return Iran to the familiar posture of defiance if the president's message of moderation falls on deaf ears abroad.
As the president prepares to travel to New York to attend the United Nations General Assembly this month, U.S. military strikes on Syria could derail Rouhani's diplomacy before it even starts.
"You can hardly think of a more unlucky situation for a moderate government which wants to relax tensions with the world," wrote columnist Maziar Khosravi in Iran's reformist Sharq newspaper on Monday, referring to the likelihood of U.S. strikes to punish Assad for an apparent chemical weapons attack near Damascus on Aug. 21.
Syria is Iran's sole regional ally, and Western foes say Tehran is supporting Syrian President Bashar al-Assad with arms, cash and Revolutionary Guardsmen to train militia to help win the civil war.
A U.S. strike on Syria would spell "the end of a diplomacy aimed at reducing tensions with the West and reconciliation with the world," wrote Sadeq Zibakalam, a professor at Tehran University, in Etemad, another reformist newspaper, last week.
"The atmosphere between Syria's allies and the West, after a Western attack on Syria, will become so cold and dark that there would be practically no space for reducing tensions and improving relations ... Iran will be forced to change its tone towards the West to a hostile one."
Raising the stakes
In Washington, some people reason that a U.S. strike on Syria would improve the prospects of a deal with Iran by reinforcing the credibility of the implicit U.S. threat to use force to prevent Iran acquiring a nuclear weapons capability.
"If there are a set of finite but effective strikes against Syria, the effect on the Iranians will be real," said Dennis Ross, a former White House and State Department official who served as one of President Barack Obama's key advisers on Iran.
"It raises the stakes for them of not having diplomacy succeed," said Ross, now with the Washington Institute for Near East Policy think-tank.
Conversely, Ross said a U.S. failure to punish Syria for crossing Obama's "red line" with the use of chemical weapons might make Iran believe it could pursue its nuclear program with impunity.
This argument is reinforced by the view held by many in the United States that it is the sweeping U.S., European Union and United Nations sanctions on Iran that have brought about Iran's new willingness to engage over its nuclear program.
However, there are those who make the opposite case: that strikes on Syria would reinforce those in Iran who favour obtaining nuclear weapons and undermine a potential deal.
"There's a valid argument to be made that U.S. inaction in Syria will embolden Iran to move forward with its nuclear ambitions. There's an equally valid argument that if the U.S. attacks Syria, Iran will feel an even greater need for a nuclear deterrent," said Karim Sadjadpour, an analyst with the Carnegie Endowment for International Peace think-tank in Washington.
Divisions in Tehran
When considering their response to any strike on Syria, Iranian leaders must weigh the costs and benefits of backing Assad, versus the advantage to be gained from a possible detente with the United States, the prospect of a nuclear deal and the easing of sanctions.
So far, Iran's response to the chemical weapons attack suggests disagreement within the corridors of power in Tehran.
A chorus of Revolutionary Guards commanders have issued daily dire warnings that U.S. strikes on Syria would result in a conflict engulfing the whole region - implying retaliation against Israel, presumably by Iran's Lebanese ally Hezbollah.
"An attack on Syria will mean the imminent destruction of Israel," IRGC commander Mohammad Ali Jafari was quoted as saying last week in an interview with the Tasnim news agency.
In a speech on Wednesday, Rouhani said any U.S. strike on Syria would be illegitimate.
"The fact that the United States has asked for feedback from its own Congress for action against Syria means that the United States does not have international legitimacy for this action from the United Nations, the Security Council, and public opinion," the ISNA news agency quoted Rouhani as saying.
Rouhani has also condemned the use of chemical weapons, pointing out that Iranian troops were victims of gas attacks during the 1980-1988 Iran-Iraq war. He stopped short of apportioning blame for the attack in Syria.
Foreign Minister Mohammad Javad Zarif went further, blaming Syrian rebels. He also warned the United States not to get involved: "The Syria crisis is a trap set by Zionist pressure groups for (the United States)," Iran's English-language channel Press TV quoted him as saying.
But Zarif has also offered some mild criticism of the Syrian government.
"We believe that big mistakes made by the government in Syria unfortunately provided an opportunity for abuse," Iranian media quoted him as saying this week. He has also repeatedly called for diplomacy as an alternative to Obama's stark alternatives of military strikes versus inaction.
Former President Akbar Hashemi Rafsanjani, an ally and mentor of Rouhani, appeared to go further last week by blaming the Syrian government for the Aug. 21 attack.
The Foreign Ministry denied Rafsanjani said any such thing, but while the semi-official state news agency that originally quoted him changed those comments, it left unchanged Rafsanjani's charge that in Syria "the prisons are overflowing and they've converted stadiums into prisons".
"The Syrian crisis is as polarising for Iran's political elite as it is for the international community," said Yasmin Alem, a senior fellow at the Atlantic Council's South Asia Center. "It is no longer clear whether Syria is the lynchpin of Iran's security or a threat to it."
Much depends on the intensity and extent of any U.S. attacks on Syrian government forces and facilities.
"A limited attack with minimum impact on the balance of power in Syria is unlikely to impede nuclear diplomacy with Iran," said Ali Vaez, senior Iran analyst at the International Crisis Group.
"Rouhani's success depends on rescuing Iran's ailing economy, the realization of which is nearly impracticable without sanctions relief. If he allows Syria to spoil the nuclear negotiations, his presidency will falter just one month after it began."