While defeating ISIS in its strongholds of Mosul and Raqqa is a key step, it is only a first step. For Trump, preventing the rise of a successor to ISIS will require a diplomatic effort aimed at reaching political settlements in both Iraq and Syria. That means taking stock of the region’s changing needs.

Since Republicans last held the White House, the long-standing regional order that Washington relied on for decades has disappeared. In its place: a contagion of conflict fueled by popular protest against sclerotic authoritarian regimes, and sectarian and tribal fighting over scraps of broken states. All this, as Iran, Saudi Arabia, and Turkey jockey for influence to protect their interests where they must, and further them where they can.

Obama largely sidestepped dealing with any of this, focusing instead on defeating ISIS. What would happen after ISIS was his successor’s concern. Trump cannot afford such insouciance. The Middle East overshadowed Obama’s pivot to Asia, and it could do the same to the president-elect’s foreign and domestic priorities. The task for Trump is to arrive at a new regional order, one that would repair the frayed map of the Middle East and shore up its governments.

For decades, the United States relied on dictatorships to ensure regional stability. That bedrock is no more. The so-called Arab Spring popular uprisings buffeted state institutions, first provoking social strife, and in the worst instances, civil war. Sects and tribes—filial identities long hidden behind the edifice of dictatorship—saw threat and opportunity in the ensuing chaos, igniting paroxysms of violence that led to more disorder.

The most intense competition is between Sunnis and Shiites. This is a political rivalry that has been enshrined in the division of power in states across the region, from Lebanon, Syria, and Iraq in the north, to Bahrain and Yemen in the south. More broadly, it also afflicts Saudi Arabia, Pakistan, and Afghanistan. Every turn in the regional collapse has ineluctably stoked the Iranian-Saudi rivalry.

As a consequence, the Arab world has been pulverized. Iraq and Syria are, for all intent and purposes, no longer nation-states in control of their territories. Saudi Arabia and the Persian Gulf emirates have been spared the worst of the upheaval. But after long relying on America for their security, they now lack the capacity to manage the region on their own. Saudi Arabia’s strength has also been sapped by low energy prices, uncertain leadership, and its taxing war in Yemen.

Power in the Middle East has moved from its Arab heartland to Turkey and Iran. Turkey weathered a failed coup, but does not seem to have lost a beat in aggressively pursuing its regional agenda. In a replay of the erstwhile Ottoman-Safavid division of the Middle East, Turkey and Iran are now poised to step into the regional vacuum. The two frequently coordinate their positions on the Kurds, and have signaled a willingness to shoulder some of the burden that Washington either cannot take or does not want.