The liberation of Raqqa, Syria, the Islamic State’s final stronghold, has severely weakened the group as a military threat. But as its members slink off the battlefield to melt into local populations or infiltrate nations in Europe, Africa and around the world, they leave a region in ruins and an almost impossible challenge for the United States.

Over four gruesome years, ISIS swallowed up large areas of Iraq and Syria, taking control of oil fields and using beheadings, rapes and other cruelties to terrorize populations. Now, the degradation of the group has allowed Iran, Russia and others to scramble for advantage. The anti-ISIS coalition is fracturing, reviving divisions and creating conditions that could allow the extremists to regroup. And American leaders seem to have no clear plan to manage this instability or to capitalize on their military success.

One big concern is the semiautonomous region of Kurdistan, which until recently was Iraq’s anchor. Today its future, and that of a unified Iraq, is in doubt. That’s because of an independence referendum in September that was pushed through by Masoud Barzani, then the Kurdish leader, despite warnings from Iraq’s central government, Turkey, Iran and the United States — the Kurds’ main ally — that the vote could lead to Iraq’s dissolution, undermine the anti-ISIS fight and widen divisions even among Kurdish factions.

Since the referendum, which won overwhelming support from voters, Iraqi forces took control of Kirkuk, an oil-rich Iraqi city that Mr. Barzani — taking advantage of the threat of ISIS at the time — had Kurdish military forces seize in 2014. Iraq is also reportedly moving to take control of Kurdistan’s border crossings with Syria and Turkey from Kurdish forces armed and trained by Washington. Mr. Barzani has been forced from power.