The grand ambitions scribbled on a wall near the Libyan city of Sirte’s Mediterranean Sea front look fanciful now with the words, “Islamic State’s naval port, and the departure point for Rome, with God’s permission.”

Beaten back by local forces over three months and by U.S. air strikes since Aug. 1, Islamic State is on the verge of losing the city where it exerted absolute control since last year, its most important base outside Syria and Iraq.

But while defeat in Sirte will be a critical blow, it will not be the end of Libya’s jihadist threat.

Some militants were able to flee Sirte before it was encircled and are likely to try to reactivate elsewhere in Libya”, officials and fighters say.

Militants may link up with existing cells and armed factions already operating in other regions, as the divisions that fuelled extremism in Libya persist and even risk worsening as a result of the Sirte campaign.

Officials give few details on fighters detained or killed in the battle for Sirte, saying they find it hard to trace militants who use different identities and that resources to track and intercept fugitives are scarce.

But according to Mohamed Gnaidy, a military intelligence official in Misrata, a western Libyan city, about a dozen militant commanders and hundreds of more junior fighters may have slipped away.

Important leaders escaped from Sirte,” he said. “We think there are some in the desert who will try to regroup and continue with the same ideology.”

That does not mean Islamic State will resurface openly in another Libyan town, Gnaidy and other officials said, rather, the group could stage revenge attacks or wage an insurgency, operating sleeper cells in urban areas and forging new alliances in the vast open spaces of the south.

One of the few things we know for sure is that Islamic State cannot continue acting like a state actor as it has in the past,” said Marco Arnaboldi, a researcher of political Islam specialising on Libya.

Sirte, the home town of toppled dictator Muammar Gaddafi and the last big city to fall in the 2011 uprising that overthrew him, sits in the centre of Libya’s coast, midway between areas controlled since 2014 by rival governments in the east and west.