Fighters of Libyan forces allied with the U.N.-backed government fire a rocket at Islamic State fighters in Sirte, Libya. Image Credit: REUTERS

It’s far from a triumphal scene: a shattered ghost city, riddled with land mines and booby traps, still echoing with the crack of sniper fire. These days, this is what a prospective victory over the fighters of Daesh looks like — grim, costly and already shadowed by what lies ahead.

American-backed Libyan militias said last week that they were consolidating their hold over the coastal oil-crescent city of Sirte, Daesh’s last real bastion in Libya — and, until this week, the group’s most important territorial toehold in North Africa.

The impending loss of Sirte — more than 1,000 miles from Daesh’s heartland in Iraq and Syria — represents a powerful blow to the group’s ambitions to expand its self-declared caliphate into Libya, a failing but resource-rich state a few hundred miles across the Mediterranean from Europe.

But analysts said Daesh, which has made resiliency its hallmark, probably retains the ability to imperil Libya’s fragile government, as well as more distant targets, by shrugging off territorial and battlefield losses and turning its attention to guerrilla-style insurgency.

“It will be a mutation of strategy,” said Karim Mezran, a senior fellow with the Atlantic Council’s Rafik Hariri Centre for the Middle East. “It’s possible the foreign (Daesh) fighters will disperse in the desert and try to form small groups; the Libyan component will remain in Libya and foster terrorist activities — car bombs, targeted assassinations and so forth.”

Libya’s rival armed factions have in the past proved their ability to unite against a common enemy, as they did in the toppling of dictator Muammar Gaddafi, only to swiftly turn on one another in the struggle for oil wealth and power. The country has been riven by bitter infighting since the region-wide “Arab Spring” uprisings.

Even by those benchmarks of carnage, the battle for Sirte has been a savage one. A ragtag band of armed groups, drawn mainly from the nearby city of Misrata, has waged a summer-long campaign to dislodge Daesh fighters from the city where Gaddafi was hunted down and killed.

As has sometimes happened in the past, Daesh may have brought about its own downfall with overreach. The offensive began in May after Daesh fighters seized a checkpoint west of Sirte, not far from Misrata. The Misratans then spearheaded the attacking force, joined by other armed groups — though the durability of that alliance is questionable.

“It’s telling that with so many factions that are intent on fighting or spoiling others’ interest, the one instance in which they accede to Western interests is Daesh,” said Tim Eaton, a Libya expert at the British think tank Chatham House. “None of the factions has any interest in them sticking around.”

The campaign to retake Sirte was slowed by the defenders’ use of cunningly planted explosives, thunderous suicide bombs and well-trained snipers. The attackers’ losses surpassed 200 by July. US airstrikes that began on August 1, together with the technical assistance of small groups of US, British and Italian special forces, helped rally the Misratan-led forces, the militias laying siege to the city said.

A key turning point came with Wednesday’s capture by government-allied fighters of strategic sites, including a Gaddafi-era convention centre, a hulking symbol of Daesh’s year-long reign over Sirte. Jubilant militiamen raised their flag atop the complex to supplant the black Daesh banner that had flown there.

The militias aligned with Libya’s United Nations-supported government, a shaky seven-month-old enterprise that represents the latest effort to impose some semblance of statehood on the chaotic nation, said on Thursday that they were in the process of clearing several remaining neighbourhoods of Daesh holdouts. The mayor of Sirte, Mokhtar Khalifa, told The Associated Press that the city was “70 per cent free — it will soon be completely free”.

But the defenders, especially those who see no chance to slip away, may be motivated to fight to the death, according to witnesses to the combat.

“This is their last stand, a final showdown, and I expect they’re going to put up a fight,” said Frederic Wehrey, a senior associate at the Carnegie Endowment’s Middle East Programme who twice visited the front lines over the summer. “The nature of the fighting I observed in those types of settings was quite tough going, block by block, with snipers, mines, booby traps.”

Illustrating the intimate scale of the urban combat in Sirte, the US airstrikes — three dozen of them to date, according to the US Africa Command — have often taken aim at targets tiny in size but outsized in threat. A list of the latest strikes included several lone Daesh vehicles, after the Misratans and their allies suffered heavy losses from truck bombs and armour-protected heavy weapons.

The civilian toll, too, has been heavy. The United Nations estimated last month that more than 90,000 people had fled the city, representing more than three-quarters of its population.

Those who found haven in nearby towns told of now-familiar horrors of daily life under Daesh’s harsh rule: crucifixions and beheadings, arcane accusations of sorcery and witchcraft, public floggings, punishing taxes, young boys seized as conscripts.

“Daesh arrived, and the end of our lives began,” a woman named Fatima, who sought safety in Misrata, told the online news portal Middle East Eye last month. “They took possession of all aspects of our lives.”

Once the fighting winds down, competing agendas are all but certain to emerge.

Gaddafi was born outside Sirte, and the city has long been associated with him; Misrata was the cradle of the revolution. The Misratans, having shed blood to retake Sirte, are already seeking a leading role in its post-Daesh order, but many townspeople — who may not be able to return for weeks or months — dislike and distrust them.

“Relations between the two cities have been very poor. That’s where it becomes very tricky to get past these enmities,” said Eaton.

Sirte was not Daesh’s first foothold in Libya — the group had seized the eastern town of Derna nearly two years ago — but it was the most significant one, providing a gateway for arriving foreign fighters and ready access to oil facilities. President Barack Obama, in authorising airstrikes, declared that the campaign was needed to prevent Daesh from developing “a stronghold in Libya”.

While inviting limited Western help in staving off Daesh may be a popular move, the UN-brokered unity government, led by Fayez Al Sarraj, still faces a crisis of legitimacy in the eyes of many. It has yet to win endorsement from the internationally recognized parliament, which is based in Libya’s east.

More pressing for many Libyans is the chronic lack of any of the trappings of governance. Analysts point to dismal conditions even in the capital, with power rationed to four hours a day in the scorching summer heat, garbage piling up, currency devaluations and long lines outside banks.

“There’s enormous popular frustration in Tripoli,” said Wehrey.

In the longer run, he noted, the very militias that are breaking Daesh’s grip on Sirte — as well as heavyweight rivals from outside that fold, such as the eastern-based ex-general Khalifa Haftar — will need to at some point be integrated into a regular army and police force.

But powerful armed groups, each with its own agenda, have held sway for so long that the scenario seems unimaginable to some.

“Stability is fundamental, so stabilising Sirte is fundamental,” said analyst Mezran. “The issue, though, is that [Daesh] wasn’t the cause of instability. It was a consequence.”