Airstrikes are intensifying on areas of Iraq held by the militant Islamic State, and the group has beheaded a second American hostage. But clear indications of a strategy to tackle the escalating Islamic State problem are hard to find. Indeed, in a statement in late August, U.S. President Barack Obama affirmed that the United States did not yet have a strategy to combat this militant threat.

The president did, however, single out further cooperation with “Sunni partners” against the Islamic State. Such regional partnerships are necessary, but putting such an emphasis on Sunni players misses a crucial component without which no strategy against the Islamic State will succeed: finding a way to appease the rivalry between Iran and Saudi Arabia.

Both Tehran and Riyadh see the Islamic State as a threat. But the two are also out to protect their own interests above all else, and that means that for them, eradicating the Islamic State can only happen if the powers prevailing in its wake in Syria and Iraq are sympathetic to those interests.

For Iran, the Islamic State has the potential to grow into an existential threat.

The Islamic State’s advance in Iraq was the turning point in its relationship with the Syrian regime, as prior to that, the Assad government had refrained from attacking the group because it was useful in fighting rebel forces like Jabhat al-Nusra and the Free Syrian Army. The advance in Iraq not only was an attack on a Syrian ally—the Iraqi government—but also marked the Islamic State as a looming risk on Iran’s border.

Both the regime of Bashar al-Assad in Syria and Iran were quick to attack the Islamic State. Damascus bombed the group’s stronghold Raqqa in Syria. Tehran, meanwhile, rallied its troops to help fight the Islamic State on Iraqi soil before it could reach Iran—its pro-Assad, multinational Shia militia Abu al-Fadl al-Abbas brigade and its Lebanese ally Hezbollah (both of which had been fighting in Syria), as well as its elite Revolutionary Guards.

As the sectarian tension in Iraq intensified, with Sunni tribes in Mosul aligning themselves with the Islamic State and against the Shia-dominated Iraqi government led by then prime minister Nouri al-Maliki, Iran calculated that it would be in its interest to sacrifice Maliki for the sake of stability. Tehran supported the election of Haider al-Abadi as Iraq’s new prime minister.

By supporting Abadi, Iran became inadvertently aligned with its archrival Saudi Arabia. Riyadh saw in the replacement of Maliki a way to alleviate civil strife and an opportunity to increase Sunni representation in Iraqi politics through the formation of a new national unity government.

Saudi Arabia also views the Islamic State as a serious threat because the group harbors a number of jihadists from the Gulf, and the return of those militants to their home countries would bring with it the prospect of further regional instability.

However, despite sharing animosity toward the Islamic State with Iran, Saudi Arabia is still concerned about what would happen if the group were eradicated as the situation in Iraq and Syria currently stands. In Syria, the Assad regime is stronger than the moderate opposition, while Iraq still has not formed a national unity government. The eradication of the Islamic State without alternatives to the Assad regime and to a Shia-dominated government in Baghdad would mean the survival of Iran’s two allies in those countries. The continuation of the political status quo in Syria and Iraq would consolidate Iran’s influence in the region.

It is certainly rational that the United States would—and should—not seek to engage in upgraded action against the Islamic State, whether military or political, without the engagement of its regional partners. But if the United States seeks to establish an international and regional coalition against the Islamic State, the success of the effort will depend on whether Saudi Arabia and Iran can reach a degree of compromise on their respective roles in the Middle East. That will at base require that both accept power sharing among their own allies.

Iran is likely to accept a scenario for Syria’s Assad similar to Iraq’s Maliki. This degree of flexibility stems from the fact that Iran’s ultimate aim is not to support Assad but to have a government in Damascus that would guarantee its own interests. But Iran cannot see in the current Syrian political milieu an alternative to Assad that would play this role.

Saudi Arabia will also only support multinational action against the Islamic State if it can guarantee a role for itself in Syria and Iraq after the group is defeated.

Both those scenarios point to the crucial need for dialogue between Saudi Arabia and Iran that would lead to the formation of national unity or transitional governments in Iraq and Syria, whose members would be acceptable to both regional players. Only when such a political alternative is on the table can a strategy for combating the Islamic State that involves cooperation among Middle Eastern partners be implemented effectively.