The capture of Baghouz by the Syrian Democratic Forces marks a big moment in Syria's eight-year war, wiping out one of the main contestants' territory, with the rest split between President Bashar al-Assad, Turkey-backed rebels and the Kurdish-led SDF.
Assad and his Iranian allies have sworn to recapture all Syria, while Turkey has threatened to drive out the SDF, which it sees as a terrorist group. The continued presence of US troops in northeast Syria might avert this.
The SDF has urged Assad to recognise autonomous administration in areas controlled by it and Turkey to quit areas of northern Syria it has taken over.
Islamic State originated as an al-Qaeda faction in Iraq but took advantage of Syria's civil war to seize land there and split from the global jihadist organisation.
In 2014, it grabbed Iraq's Mosul, erased the border with Syria and called on supporters worldwide to join a jihadist utopia, complete with currency, flag and passports.
Oil production, extortion and stolen antiquities financed its agenda, which included slaughtering some minorities, slave auctions of captured women, grotesque punishments for minor crimes, and the choreographed killing of hostages.
Those excesses drew an array of forces against it, driving it from Mosul and the Syrian city Raqqa during a year of heavy defeats in 2017 and driving it down the Euphrates to Baghouz.
Over the past two months, about 60,000 people poured out, fleeing SDF bombardment and a shortage of food so severe that some were reduced to cooking grass.
Intense air strikes levelled entire districts and, according to rights groups, killed many civilians.
Civilians made up more than half the people leaving Baghouz, the SDF said, including women from the Iraqi Yazidi sect whom the jihadists sexually enslaved.
Thousands of the group's unbending supporters, including many foreign women who married jihadists, also abandoned the enclave. At displacement camps the SDF had to keep them away from other, often traumatised, residents.
Their fate has befuddled foreign governments, who see them as a security threat and are loath to accede to SDF entreaties to repatriate them.
As the fighting progressed, convoys of trucks from Baghouz started to include hundreds, and then thousands, of surrendering jihadist fighters, many hobbling from their wounds.
The SDF said it captured hundreds more in recent weeks who tried to slip through its cordon and escape into Iraq or across the Euphrates and into the Syrian desert.
At the end, they were holed up in a tiny enclave from which they released a video showing fighters still shooting with smoke billowing above - an attempt to portray their last stand as heroic and a call to arms for future jihadists.
Australian Associated Press