As Islamic State’s last defences crumbled this week in their Libyan bastion Sirte, dozens of women and children used as human shields stumbled dazed and dust-caked from the rubble.
Fighters from the armed groups that defeated the militants feted the end of a punishing six-month battle by flying Libyan flags over the Mediterranean city.
But the campaign has been far from the unifying event some had hoped for.
Celebrations have been muted by the risk of militant counter attacks and the potential for renewed war among Libya’s military factions.
Just hours after the last district in Sirte was cleared, fighters in a newly formed force swept up from the desert south of the city towards Libya’s Oil Crescent, looking to recapture ports that had changed hands three months before.
Tripoli has seen its worst clashes for more than a year as the capital’s militias rolled tanks onto the streets in a feud infused with ideological and political disputes.
And in the main city in the east, the Libyan National Army (LNA) continued to suffer heavy casualties as it struggles to secure parts of Benghazi against Islamist-led rivals after more than two years of warfare.
A half-formed, UN-backed government based in the capital looks increasingly helpless to stop the turmoil - though Western powers insist that it represents the only path towards peace.
UN Libya envoy Martin Kobler told the Security Council this week that while a peace plan signed a year ago had stalled, weapons were still being delivered into Libya, the economy was facing “meltdown”, and the country remained a “human marketplace” for migrants trying to reach Europe.
Gains against militants in Sirte and Benghazi were “not irreversible”, he added.
The campaign in Sirte was led by brigades from Misrata, an influential port east of Tripoli.
They launched their offensive in May when militants advanced up the coast towards their city.
The UN-backed Government of National Accord (GNA) scrambled to take command, but only ever had nominal control over fighters on the ground, some of them with different agendas beyond the campaign in Sirte.
The brigades hoped the battle would be finished in weeks, but their progress was halted by Islamic State snipers, suicide bombers and mines.
By mid-summer, with casualties mounting and an official request from the GNA, they called in the help of US air support.
Fear of an Islamic State comeback or insurgent campaign is the stated reason for not declaring an official end to the operation in Sirte.
Libyan security officials say a significant number of militants left Sirte before the battle or in its early stages, and that Islamic State has cells along Libya’s western coast as well as in the hinterlands.
Even as the fighting continued in Sirte’s residential neighbourhoods, the group carried out attacks from behind the front lines, including suicide bombings and a major ambush.
Military officials say they will now move to deal with this threat by securing the desert valleys south of Sirte and chasing down fugitive militants.
But they are also nervous about Khalifa Haftar, the commander of the LNA in the east, who has fought on the side opposed to Misrata’s brigades in a stop-start national conflict since 2014, and has recently been boosted by his own military advances.
Related Story