Raqqa, self-styled capital of the self-styled Islamic State’s self-styled caliphate in eastern Syria, fell to Kurdish and Sunni Arab forces last week. The event was an indisputable success for the US-led anti-Isis international coalition. For the city’s inhabitants, it meant the end of a terrifying three years under the rule of a nihilistic cult. Isis’s rule in Raqqa made a global statement, showcasing its atrocities and its ideology: there were beheadings in a sports stadium, gay men thrown off rooftops, women reduced to slavery, and children indoctrinated to become suicide bombers. That the insurgent group has now been kicked out is a piece of good news for the Middle East and beyond.

It is much too soon to claim that Isis has been beaten for good. It still holds pockets of territory across the Syria-Iraq border. Nor is Sunni disenfranchisement – a key recruiting sergeant for Isis – likely to disappear if the Syrian dictator, Bashar al-Assad, is allowed to continue to persecute his people. Donald Trump’s assertion on Saturday that the fall of Raqqa heralded a political transition for Syria is both cynical and hollow. There is no sign whatever of such a transition in Damascus.

Nor can it be said that the wider region is any closer to stability, let alone peace. As Raqqa fell, a second city, Kirkuk in neighbouring Iraq, changed hands too. Here, though, the circumstances were very different. Kurdish peshmerga forces, who had held Kirkuk and nearby oil fields since 2014, were pushed out by the Shia-dominated Iraqi army. Just weeks earlier, a referendum in Iraqi Kurdistan voted overwhelmingly for independence. Designed as a measure to further the Kurds’ long-held political aspirations, the vote backfired badly. Baghdad government troops swept in almost unopposed. Divisions among Kurdish factions played no small role in the collapse.

That, in just one week, Kurdish forces should be victorious in Raqqa but crushed in Kirkuk, is part of a chaotic realignment across the region. Anticipating the imminent demise of Isis power, local armed groups and the nation states that act as their patrons have moved quickly to hedge their positions and fill any vacuum. Alliances are shifting as circumstances change, and lines are redrawn in the sand. A regional free-for-all is in motion, whose end game no one can predict.

Kurdish and Iraqi forces who had allied against Isis, both of them trained and equipped by the US, have now turned against one another. In Syria’s eastern desert, US- and Iran-supported groups who once confronted Isis in parallel are now violently competing for strategic landmarks. Tactical solidarities are also wearing thin. Turkey, formerly an active supporter of the anti-Assad insurgency, now seeks Russian support against the Kurds, while announcing it will send ground forces into Syria’s rebel-held province of Idlib.

Blunt military power and geopolitical opportunism governs these events in the Middle East. Diplomacy has all but been abandoned. There is no rule book except might-makes-right. As Isis-held territory shrinks, states and non-state entities alike vie for influence and conquest. Sectarian and ethnic differences fuel a dangerous dynamic. Comparison with the thirty years’ war may not be exaggerated.

However, the one state that has so far gained more than it has lost in this multifaceted regional war is surely Iran. With its troops and its proxies deeply involved on the ground, Iranian sway has grown across Iraq, Syria and Lebanon. It has capitalised on chaos as well as on American errors and miscalculations. Mr Trump’s recent threats against Iran should perhaps be seen in this context as an attempt at pushback, but they have the potential to create even larger problems. As Isis recedes, the world is witnessing a scramble for the spoils. For the moment, every military victory sets the stage for another confrontation, not for talks. For the people of Raqqa, Kirkuk and many others, it is a recipe for more, not less, uncertainty.