Iran and America are not on the same side in Iraq
The recent fall of Mosul to the forces of the Islamic State of Iraq and the Levant (ISIL), a capture that coincided with images of thousands of Iraqis troops abandoning their weapons as tens of thousands fled the terrorist advance, has led to suggestions in some quarters that the United States and Iran may cooperate within Iraq. Superficially the benefits of such an arrangement seem obvious, at least to the United States. Both Iran and the United States wish to avoid a takeover of Iraq by ISIL, while the United States, which does not want to have to deploy its own troops, would likely welcome Iran's willingness to do so in its place. Furthermore, the Obama Administration has been doing everything in its power to try and reach out to the Rouhani Administration and to extend the thaw in American-Iranian relations beyond talks over the Nuclear Program. This has occasionally taken on a willingness reminiscent of the Reagan team during Iran-Contra to pay for superficial gestures such as phone conversations and personal meetings with real concessions in the hope that if US and Iranian officials pretend to act friendly to one another, real friendship will follow. This seems to be point of today's announcement that US and Iranian officials met to discuss cooperation. The US announced the meetings, with John Kerry suggesting cooperation was on the table, only to have the Iranians announce that they had ruled it out.
Despite American wishful thinking that if they keep announcing cooperation that it somehow will actually occur, it's hard to see it happening. Rouhani lacks control of the major military forces of the Iranian state. The President and Cabinet only posses authority over the Artesh, the regular military which is underfunded and rarely deployed. Even this authority is circumscribed by the fact that the Minister of Defense is usually selected by the Faqih(leader). As for the Revolutionary Guards and Security forces, the former of which have been deployed to Iraq, their officers are appointed by the Faqih and the Judiciary Chief respectively. Rouhani therefore lacks the ability to cooperate even if he wanted to, and he most likely does not; the costs of cooperation domestically in the form of attacks by the Revolutionary Guard and open sabotage would likely trump any gain.
As for the Revolutionary Guard, their language has been if anything more belligerent towards the United States in the last week than previously. Iranian Armed Forces Chief of Staff Major General Hassan Firouzabadi declared today that ISIL was a "Zionist and American" plot and that America was an ally to the terrorists in the region. While this claim may seem like the usual nonsense from Tehran, there is a legitimate point behind the bluster. ISIL is fundamentally an anti-Assad Syrian opposition group, and the United States and EU along with Saudi Arabia and Qatar, two American allies, have been the major backers of the Syrian opposition. That Barack Obama and David Cameron failed to persuade their legislatures to go along with them last August does not change the fact that both favored intervention against Assad. As such, the American position of claiming to oppose ISIL's actions in Iraq seems a bit disingenuous when the United States was doing everything in its power to if not support it, at least undermine its foes in the Assad government. No wonder Iranian officials called ISIL's fighters "US Mercenaries" last week:
“The most effective way to end the violence in Iraq is for Washington and its allies to stop fuelling the proxy ISIL mercenaries and their war of terror in Syria, Iraq and elsewhere in the region,” the analyst wrote.
This leads to doubts about US objectives. Does the US want ISIL destroyed or just driven out of Iraq? Would the US cut a deal with them if they focused only on Syria? Odds are that Obama's National Security team doesn't even know the answers to these questions; their approach to the Middle East has been so disorganized, with policy towards Egypt, Syria, Iraq, Turkey, and Iran utterly uncoordinated, that they likely have ignored the issue of linkage between Syria/Egypt and everything else.
Iran has not. Nor has it forgotten its goals in Iraq which are not fully compatible with those stated by the United States. Iraq's fundamental problem is the exclusion of the Sunnis from the political process. The 2007-2008 "Surge" had both a military and political track. Along with providing an increased military presence in the Sunni regions, the United States and Maliki did everything in their power to persuade the Sunnis, who had largely boycotted the 2005 elections, to participate in the 2009 local and 2010 national polls. At the time this political approach seemed as promising as the military effort that preceded it. In 2010 the largely Sunni Iraqiya coalition led by Ayad Allawi came first with 91 seats to 89 for Nouri Al-Maliki's State of Law Coalition. But rather than allowing Allawi to form a government, Maliki formed a coalition with his bitter Shia rivals in the Iraqi National Alliance, entirely excluding Allawi's party and by extension the Sunnis from power. In 2014, Sunni turnout dropped substantially, as their voters felt betrayed. This betrayal fed the success of ISIL.
Iran, is not however, unduly concerned about the breakdown of the Iraqi state. While Tehran does not desire a Sunni Islamist Iraq, it doesn't particularly want a multicultural or even strong Shia-led Iraq either. Such a state, especially if it remains democratic, would pose a serious threat to the legitimacy of the Iranian regime, especially given the relatively "liberal" outlook of Iraq's Shia clergy compared to Iran's. Many senior Iraqi clerics showed sympathy for the Green Movement in 2009 and Iran is not interested in a repeat.
The best shot Iran has at preventing one is for Iraq to be dominated by a weak Shia regime in the south and center dependent on Iranian military support. Such a government would be unable to seriously oppose Iranian policies, or to allow its senior leaders to criticize Iran's internal arrangements. It would also allow Iran to effectively exclude the United States from the country, something that would be harder in a state with substantial Kurdish and Sunni influence.
Iran therefore has an interest in supporting Maliki to the extent that the fall of Baghdad is prevented, but has no real reason to want to win his war for him. This is also why the United States should not raise its expectations too high regarding cooperation with Iran. The goals of the Iranian and American governments in Iraq are still far too great.