Back in 1977, President Jimmy Carter issued a now-infamous remark during a visit to Tehran, when he toasted the soon-to-fall Shah of Iran and called his country an “island of stability.” Maybe he was just a few decades early. Today, even a cursory look at the region between North Africa and Afghanistan reveals that Iran, now led by a new president who’s seeking to strike a deal with the United States and the West, is indeed an island of stability—especially when measured against chaos in Libya, a profound crisis in Egypt, civil wars and violence in Syria, Iraq and Lebanon, and an Afghanistan that may very well fall apart when the United States leaves.

That’s precisely why it’s so important for the talks between the United States and Iran to succeed. Iran can play an important stabilizing role in Afghanistan, Iraq, Syria and Lebanon. Indeed, according to the Associated Press, Tehran has quietly offered to assist Iraq’s Prime Minister Maliki in Iraq’s battle against Al Qaeda, which is trying to seize and control territory in Anbar Province and has captured significant parts of Ramadi and Falluja, two important Anbar towns. According to the report, Iran’s army deputy chief of staff has offered to supply Iraq with “military equipment and advisers” but said that Iran would not supply Iraq with Iranian troops. Ironically, the general’s remarks came just as Secretary of State John Kerry, on a lengthy swing through the Middle East, said almost exactly the same thing, namely, that the United States would supply Iraq with arms, military assistance and other help, but no troops. Said Kerry:

“This is a fight that belongs to the Iraqis. We are not, obviously, contemplating returning. We are not contemplating putting boots on the ground. This is their fight, but we’re going to help them in their fight.”

Maliki, and Iraq’s Shiite government, are aligned closely with both Iran and the US, and they have been since 2003, when the George W. Bush administration toppled Saddam Hussein and put into power a group of Shiite militants and radicals who had lived in Iran and who had intimate connections with the leaders of the Islamic Republic of Iran. So it’s not surprising that the United States finds itself on the same side as Iran when it comes to Iraq’s battle against Al Qaeda.

Now it’s time for the United States to apply the same logic to the war in Syria. Supposedly, though it’s not certain, there will be a peace conference of some kind in Geneva on January 22, bringing together representatives of both the government of President Bashar al-Assad and some of the rebels battling against Assad. For the first time, Kerry said this weekend that he’s open to the idea of Iran joining the talks. That’s crucial, since Iran has a vital interest in squashing Al Qaeda in Syria as well as Iraq, and it means that tactically, if not strategically, the United States and Iran could eventually end up on the same side in both Iraq and Syria.

Ever since President Obama foolishly called on Assad to step down, a comment in 2011 that helped spark the civil war that has engulfed Syria, the rebellion against Assad has been increasingly led by radical Islamists, from the Al Qaeda-controlled Islamic State in Iraq and Syria (ISIS) to the Al Qaeda-linked Al Nusra Front to several other Islamist coalitions. More and more, it’s apparent that the United States is having second (and third) thoughts about supporting the Syrian rebels, and it may eventually figure out that it will have to reconcile with Assad. (And why not? The United States worked quite well with both Bashar al-Assad, and his father, Hafez al-Assad, since the late 1960s.) Ryan Crocker, the veteran former diplomat and ex-ambassador to Iraq, has expressed the opinion—unwelcome in many Washington circles, but certainly accurate—that it’s time to work with Assad. He wrote recently in The New York Times, in a piece entitled “Assad Is the Least Worst Option,” that “it is time to consider a future for Syria without Assad’s ouster, because it is overwhelmingly likely that is what the future will be.” He added:

President Obama’s bold declaration in 2011 that Assad must go violated a fundamental principle of foreign affairs: if you articulate a policy, you had better be sure you have the means to carry it out. In Syria, we clearly did not.… So we need to come to terms with a future that includes Assad—and consider that as bad as he is, there is something worse. A good place to start is Geneva next month and some quiet engagement with Syrian officials.

That’s smart advice. Let’s hope that Kerry’s comment that it’s time for Iran to join the Geneva talks means that the United States may soon be on the same side as Iran in both Iraq and Syria.