President Obama's decision to target militants from ISIS -- which is now calling itself the "Islamic State" or "IS" -- operating in Iraq comes as a huge relief to the Iranians. Officials in Tehran have been panic stricken since ISIS forces overran the northern Iraqi city of Mosul on June 10.
All political factions in Tehran would like to see ISIS suffer and its latest advances rolled back. At the same time, contradictory statements made in Tehran make it clear that the Iranian authorities are divided about the implications of the American military's return to Iraq.
The moderates, the group of people associated with President Hassan Rouhani's presidential administration, are nudging toward an open admission that American military operations in Iraq compliment Tehran's policy goals.
The hawks in Tehran, however, remain reluctant to publicly admit to any shared interests with Washington. Still, overall, Iran and the US are clearly going in the same direction in Iraq, at least while the fight against ISIS rages on.
At first, there was nothing but silence in Tehran as U.S. F-18s on Friday began to target ISIS militants. The silence was more than revealing. In the corridors of power in Tehran, where no opportunity is missed to condemn American foreign policy at every turn, the silence was tantamount to a roaring approval of Washington's intervention.
On Monday, the moderate faction of President Rouhani took a step to formally spell out its backing for American airstrikes. Not only was Tehran approving but is evidently looking to expand the campaign against "IS" and began touting a joint Iranian-American effort in doing so.
Mohammad Sadr, a deputy to Iran's Foreign Minister Javad Zarif, told an Iranian newspaper "Iranian-American cooperation against [IS] is possible and achievable." This was the first time since the U.S .airstrikes began that a senior Iranian official has spoken in such terms.
It is easy to dismiss Sadr as bureaucrat whose words carry little weight in Tehran. But his statement was clearly carefully formulated and was hardly a fluke. And given his stature inside the Iranian system his words must be seen as a peek into the internal policy debate in Tehran about the situation in Iraq and Iran's options. Some kind of -- at least tacit -- cooperation with Washington is one of those options being studied. Politically, it is already happening.
Tehran and Washington don't just agree on the need for airstrikes against ISIS. They are also in agreement that Iraq above all needs a new political leadership and that Prime Minister Maliki has to go. Since Monday's developments in Baghdad and the nomination of a new premier by Iraq's President Fouad Massmoum, Iran's reaction has been one of approval of the turn of events.
Today, Ali Shamkhani, the head of Iran's Supreme National Security Council, gave his unequivocal approval for a new prime minister to take over in Baghdad. No more Iranian dithering on the fate of Maliki it seems.
The fact is that Shamkhani was himself heavily involved in recent weeks to seek out an alternative to Maliki, including a trip he made to Iraq in late July to consult with various Iraqi political circles. The Americans were quicker to recognize Maliki to be at the heart of Iraq's malaise but the Iranians have finally come around to the same conclusion. And this matters a lot given Tehran's immense leverage within Iraq's Shia but also Kurdish political factions.
For Shia Iran, the fight against the extremists from the Islamic State is a critical threat. Tehran desperately wants to keep Iraq intact as a nation state. It is particularly adamantly opposed to Iraqi Kurdistan seceding as Iraqi Kurds have been threatening to do. And in this equation, Maliki had become an unbearable burden for Iranian policy.
The Kurdish leadership that Tehran is so hard trying to cultivate and steer away from an independence bid want Maliki gone.
And Maliki's woeful management of the Iraqi military's response to the newly declared "Islamic State" made the Iranians just wonder what he was good for. There are reports the Iranian military is engaged in supporting Kurdish Peshmerga forces against ISIS militants. If true, this goes to show the depth of Iranian anxieties about the "Islamic State's" rise in Iraq.
Who's in driver's seat?
As far as the U.S. role in combating the Islamic State is concerned, the Iranian debate is likely to remain split between the moderates and the hawks. The moderates like to focus on the practical challenge at hand in Iraq and ways that Tehran and Washington can collaborate.
They are comfortable with limited tactical cooperation if that is all that can come out of it. And, they readily admit that the neutralization of ISIS needs an American military involvement.
The hawks, immersed in a historic cloak of hostility to the U.S., cannot yet bear to admit to this reality even if they cannot fail to see its inevitability. But all the recent trends suggest that the moderate viewpoint in Tehran has the upper hand on the policy question of Iraq and how Iran can best serve its interests.
And President Rouhani seems eager these days to battle it out with his hawkish critics. On the question of the need for Iran to negotiate and cooperate with the U.S. on its nuclear program, he told his detractors this week to go "to hell."
Time will show if Rouhani and his moderate wing can continue to sit in the driver's seat on the question of Iraq.
Alex Vatanka is a senior fellow the Middle East Institute in Washington D.C., specializing in Middle Eastern affairs with a particular focus on Iranian foreign policy. His forthcoming book is Iran and Pakistan: Security, Diplomacy and American Influence. He is also a senior fellow at Jamestown Foundation and in Middle East studies at the U.S. Air Force Special Operations School and an adjunct professor at The Defense Institute of Security Assistance Management. The views expressed in this commentary are solely the author's.