Iran distanced itself on Sunday from attacks on Saudi oil facilities but hardliners in Tehran might chalk the assaults up as a win against Washington's tougher policy toward the Islamic Republic, officials and analysts said.
Iran has denied allegations made by US Secretary of State Mike Pompeo that it was behind the attacks on Saturday, which were claimed by Yemen's Iran-aligned Houthi group. Sunni Saudi Arabia and Shi'ite-led Iran back opposing factions across the Middle East, from Yemen and Syria to Lebanon and Iraq. Saudi Arabia is leading a military coalition to back Yemen's internationally recognised government against the Houthis.
A senior Iranian official said the heightened tensions over the assaults could tip the balance of power in Iran in favour of hardliners looking to constrain pragmatist President Hassan Rouhani's ability to open up to the West.
Iran's top authority Supreme Leader Ayatollah Ali Khamenei's aversion to the United States remains a formidable barrier to any diplomatic solution, despite the likely benefits for Iran's sanction-hit economy.
"There are hawks in Iran and America and in the region who want military conflicts," said a senior Iranian government official, who asked not to be named because of the sensitivity of the matter.
"Such attacks will make a military confrontation inevitable and that is what hardliners in Iran and elsewhere want. Such confrontation will harm not only Iran but all the countries in the Persian Gulf."
Washington, a staunch ally of Riyadh, has adopted a tough anti-Iran "maximum pressure" policy to force Tehran to negotiate a broader deal that further curbs its nuclear programme, restricts Tehran's ballistic missile work and ends its support for regional proxy forces.
In reaction to tightened US sanctions on its vital oil exports since exiting a 2015 nuclear deal last year, Iran has scaled back its commitments to the nuclear agreement and has threatened to block the Strait of Hormuz in the Gulf, through which an estimated fifth of the world's oil passes.
Iran's Revolutionary Guards, an elite force which Tehran has charged with the Gulf's security and answers only to Khamenei, said on Sunday that Iran was prepared for a "full-scale war".
However, Khamenei has repeatedly said that Tehran will never initiate a war, but will make aggressors regret any attack. He has also banned talks with the United States, which the hardliners refer to as the Great Satan.
Rouhani, the architect of the nuclear pact that led to lifting of sanctions in return for Iran curbing its nuclear work, has left the door open to diplomacy by saying that if sanctions were lifted, Washington could join nuclear talks between Tehran and other powers.
"Tehran appears to think that such ... attacks give it leverage with Washington. If Trump meets Rouhani in New York, this may be the case though Tehran may have overplayed its hand," said Simon Henderson, director of the Bernstein Program on Gulf and Energy Policy at the Washington Institute for Near East Policy.
Although Washington and Tehran said there was no plan a meeting between the two leaders at the United Nations General Assembly in New York later this month, US officials have reiterated that Trump was open to meet with Rouhani with no preconditions.
"It is up to America. Iran is the winner because any such attacks increases the oil prices and Iran benefits from it," a second Iranian official told Reuters.
"America should accept that by pressuring Iran and blaming us (for all the regional crisis), they cannot bring security to the region."
Iranian authorities have called on foreign troops to leave the Gulf, calling on the Gulf Arab states to cooperate with Tehran to secure the safety of the region.