“Iran is not going to get in the way of the U.S. going after ISIS,” Mr. Nasr said. “The U.S. is not going to get in the way of Iran going after ISIS.”

The Sunni power Saudi Arabia and Shiite Iran, whose long rivalry has shaped the sectarian divide of the Middle East and played out in proxy wars in Syria and Iraq, also find themselves both opposed to ISIS. This has raised hopes in the West of an opening in the fraught relationship between the two countries that could help not just defeat ISIS in Iraq, but perhaps help end sectarian skirmishes around the region, and resolve the three-year-old civil war in Syria.

But again Mr. Nasr said he saw only a reed of hope because, despite opposing ISIS, neither has given any indication that it is ready to give up a guiding principle of the two countries’ Middle East policies: that each opposes the other.

“Right now this is more hope in the West than a reality on the ground in the Middle East,” said Mr. Nasr of a potential thaw in relations between Saudi Arabia and Iran.

The complex landscape of shifting alliances is particularly acute in Syria, where ISIS rose in the vacuum of the civil war before sweeping across Iraq. As President Obama weighs widening a military campaign against ISIS by taking on the group inside Syria, he faces an even more complex situation than in Iraq, where there are obvious allies to do the fighting on the ground, including the Iraqi security forces, the Kurdish pesh merga, and the Iranian-backed Shiite militias.

In Syria, the United States has called for the ouster of President Bashar al-Assad, while Iran has supported him. Russia, which has increasingly angered the West with its military involvement in Ukraine, is also another important ally of Mr. Assad. So Mr. Obama has to calculate how to fight ISIS without appearing to aid Mr. Assad and the agenda of Iran and Russia. If he helped the Syrian president, even indirectly, he would violate his own stated objective and anger Turkey, an important American partner in the region that has long opposed Mr. Assad.