TUNIS (Reuters) - As Islamic State’s last defenses 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.

A fighter of Libyan forces allied with the U.N.-backed government waving a Libyan flag flashes victory sign as he stands atop the ruins of a house after forces finished clearing Ghiza Bahriya, the final district of the former Islamic State stronghold of Sirte, Libya. REUTERS/Hani Amara

Fighters from the armed groups that defeated the jihadists feted the end of a punishing six-month battle by flying Libyan flags over the Mediterranean city, once known mainly as the home town of late dictator Muammar Gaddafi, more recently as the main stronghold outside Syria and Iraq of Islamic State’s caliphate.

But the campaign has been far from the unifying event some had hoped for. Celebrations have been muted by the risk of jihadist counter attacks and the potential for renewed war among Libya’s military factions.

The past week’s developments give a measure of the chaos still enveloping Libya, five years after the NATO-backed uprising that overthrew Gaddafi.

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 self-styled 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, U.N.-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.

U.N. 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 U.N.-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 U.S. air support. Nearly 500 strikes were carried out over Sirte between Aug. 1 and early December.

After the last buildings in Sirte’s Ghiza Bahriya neighborhood were secured on Tuesday, jubilant fighters paraded through the streets, chanting that the deaths of more than 700 men from within their ranks had not been in vain.

But there have been no such scenes in Misrata, a city whose fighting force was forged in the 2011 uprising and string of military campaigns in the years that followed.

COMEBACK?

“Every time after we win a war we celebrate,” said Ahmed Algennabi, a 28-year-old salesman in a Misrata perfume shop. “But now I don’t think that it’s the end of this war, and I expect more fighting against Islamic State.”

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 neighborhoods, 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.

In September, with Misrata’s fighters still tied up in Sirte, Haftar’s forces moved to seize the Oil Crescent ports, some of them just 200 km (125 miles) to the east, and many see him edging towards national power.

State control is still absent, and any patriotic feeling fostered by the campaign in Sirte is likely to dissipate soon, said Libyan analyst Tarek Megerisi.

“Now it’s over it’s just back to business as usual, because none of the divisions have been healed, none of the drivers of conflict have been stopped or put on hold,” he said.

“Everyone’s just been maneuvering, waiting for this to end, so that they can return to their power struggle.”