As they return to nuclear talks in Vienna on Monday, U.S. and Iranian diplomats are taking care to prevent the upheaval in Iraq from creating another complication for their high-priority negotiations.
Both countries have a mutual interest in preventing the collapse of the Iraqi government, which is confronting a small army of Sunni extremists on the northern outskirts of Baghdad.
But they have been bitterly at odds over each other's role in Iraq and could come in conflict again now, even as the nuclear talks reach a sensitive moment.
The nuclear talks, which in this round will run Monday through Friday, are aimed at a deal that would prevent Iran from developing nuclear weapons capability in exchange for a lifting of the tough international sanctions on its economy. Iran and the six world powers -- France, Britain, Germany, Russia, China and the United States -- are aiming for a deadline of July 20.
Iranian President Hassan Rouhani, speaking to reporters in Tehran on Saturday, left the door open to a U.S.-Iranian collaboration. He said that if the Obama administration decided to take a direct role in the fight in Iraq "we can think about it."
Obama administration officials have deflected questions about whether they would cooperate with Iran in the expanding Iraq fight. They've denied that they're talking to the Rouhani government about the issue and stressed that the Iran nuclear negotiations don't take up other subjects.
But it is clear that they hope Maliki discourages Iran from mobilizing Shiite militias to take on ISIS. That, they fear, could give the fight even more of a sectarian complexion, and could turn Sunni tribes in Iraq further away from the Iraqi government.
Robert Danin, a longtime U.S. diplomat in the Middle East, said in an interview last week that what to do about Iran's role is "one of the toughest questions involved in this." Although Iran is well positioned to help Maliki, the administration would be reluctant to have Iran, in coming to the aid of the feeble Maliki government, end up with even more influence over Iraq, said Danin, who is now with the Council on Foreign Relations.
Any such cooperation could alarm the Saudis and Israelis, both of whom worry that a U.S.-Iranian nuclear deal could open the way to greater cooperation between Washington and their regional rival.
At some point it may be difficult to avoid discussing the issue with Iran, analysts say. If President Obama decides he does want to order air strikes on ISIS, U.S. officials probably would want to make sure the Iranian officials know enough to stay out of the way.
The Obama administration has been careful over the last three years to try to keep the U.S.-Iranian conflict over the war in Syria from undermining the nuclear talks. Although U.S. officials have often denounced Iran's help for Syrian President Bashar Assad, they have also acknowledged that their interest in continuing the talks has been a factor in decisions about how far to go.
Iran and the six powers have been at an impasse for the last month. But both sides are saying they are keenly interested in a deal and want to reach it by the current deadline of July 20.
In his comments Saturday, Rouhani said he believes it is still possible for the group to work out the deal by July 20. But if it doesn't, it can simply continue negotiations, he said.