More than 30 years ago Iran dubbed the United States "the Great Satan," and more recently the U.S. branded Iran part of an "axis of evil," yet today there is talk of the two longtime rivals co-operating to quell the unrest in Iraq.

The two sides haven’t committed to putting their differences aside and sitting down as if they’re new best friends, and at this stage they’re just saying they’re willing to talk. But the possibility of these adversaries acting like friends, despite their long-standing rivalry and mutual dislike, is on the horizon.

“We’re open to discussions if there’s something constructive that can be contributed by Iran,” Secretary of State John Kerry said in an interview Monday with Katie Couric when asked about Iran’s role.

Iran’s President Hassan Rouhani similarly said over the weekend that it’s possible the two countries could work together. “We can think about it, if we see America starts confronting the terrorist groups in Iraq or elsewhere," he said.

How exactly the two longtime adversaries might co-operate isn’t clear. There is skepticism and concern about them joining forces militarily and there is no enthusiasm from the U.S. side about Iran’s troops setting foot in Iraq.

When asked about military co-operation, Kerry was cautious and said, “We need to go step by step,” but that he “wouldn’t rule anything out that would be constructive to providing real stability.”

Military co-operation not an option

"Let’s see what Iran might or might not be willing to do before we start making any pronouncements," he said.

A few hours later, though, State Department spokeswoman Jen Psaki clarified that military co-operation is not in the cards. Any talks with Iran would be focused on encouraging Iraq to form a more inclusive, non-sectarian government, she said at a media briefing.

Military co-operation would be hard to imagine for many reasons, including that the U.S. designated an elite branch of Iran’s Revolutionary Guard Corps supporters of terrorism in 2007. The U.S. also blames Iran for providing weapons, training and financial support to militias in Iraq that fought against American soldiers.

With military co-operation unlikely, the two rival powers could just open the diplomatic channels, and that would still mark an advance in relations. Talks have happened before, on Afghanistan for example, but these kinds of chats don’t occur often.

Relations have been frosty for more than three decades now, and only in recent months have they started to thaw. That’s partly because former president Mahmoud Ahmadinejad is gone and Rouhani has been trying to get the U.S. to ease sanctions against it.

Relations have progressed to a point where Iran is negotiating with the U.S. and other nations on its nuclear program in exchange for easing some sanctions. An interim deal was signed that expires July 20 and this week in Vienna the parties are trying to hammer out a final agreement.

Talks could happen in Vienna

Vienna is where talks between Iran and the U.S. could blossom. Psaki told CNN Monday night that Iraq did come up on the margins of the day's meetings, but she didn't share many details about what was discussed.

Whether the U.S. should talk directly with Iran about Iraq is provoking some mixed feelings in Washington, even among Obama’s biggest critics. Some Republicans are against it but others are in favour.

“Why did we deal with Stalin? Because he was not as bad as Hitler,” South Carolina Senator Lindsey Graham said on CNN’s State of the Union on Sunday. “The Iranians can provide some assets to make sure Baghdad doesn't fall. We need to co-ordinate with the Iranians.”

Host Dana Bash could hardly believe her ears. “I’m sorry, it's sort of hard for me to believe that I'm hearing a Republican saying, 'Sit down and talk with Iran.'”

“We need to all make sure Baghdad doesn't fall, so, yes, we need a dialogue of some kind with the Iranians,” Graham said on another Sunday talk show on CBS. “But we also need to put them on notice: don't use this crisis as a way to create a satellite state of Iraq controlled by Iran.”

Senator John McCain sees things differently and does not want the U.S. to engage with Iran. It would only make things worse, he argues.

"It would be the height of folly to believe that the Iranian regime can be our partner in managing the deteriorating security situation in Iraq," the Republican senator said in a statement. McCain said Iran sponsors acts of terrorism all over the world and has supplied rockets that were fired at the U.S. Embassy in Iraq.

"The reality is that U.S. and Iranian interests and goals do not align in Iraq, and greater Iranian intervention would only make the situation dramatically worse," McCain said.

But according to the State Department, Iran and the U.S. do have something in common — a stable Iraq is a “shared interest” and ISIS, the al-Qaeda splinter group, is a “shared concern,” Psaki said.

The Obama administration has some decisions to make on how to respond to Iraq, and one of the biggest is whether engagement with Iran is part of the plan. If that's the case, Americans will be looking to the White House to explain why it's working with a country that once considered it the devil.