By Aidan Lewis
SIRTE, Libya (Reuters) - The grand ambitions scrawled on a wall near the Libyan city of Sirte's Mediterranean sea front look fanciful now: "Islamic State's naval port, 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 fueled 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 and that they 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. But 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 specializing 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 center of Libya's coast, midway between areas controlled since 2014 by rival governments in the east and west.
Islamic State seized control of Sirte a year and a half ago as warring factions battled each other across the country.
Much of the group's Libyan force, which according to most estimates prior to the battle in Sirte numbered between 2,000 and 5,000, was based in the port city. At one stage Western officials even suggested Sirte could become a fallback option for the militants under pressure in Syria and Iraq.
But Libya's Islamic State branch, already ousted from its initial base in the eastern city of Derna, has found it hard to win support, raise revenue, and retain territory.
In January, Sirte-based militants pushed eastwards from the 250 km (155 mile) coastal strip under its control, attacking but not holding major oil terminals. In May, they surged on settlements and checkpoints to the west, provoking a counter attack from Misrata to start the campaign for Sirte.
Sirte is now a battlefield, its otherwise deserted central neighborhoods the scene of sporadic sniper exchanges, artillery fire, and house-to-house fighting.
On days of heavy clashes, dozens on both sides have been reported killed. No accurate numbers exist for Islamic State deaths, but casualties among the Misrata-led brigades testify to the enemy's force, with more than 350 killed and 1,500 wounded.
That toll prompted a request for U.S. air strikes, giving fresh impetus to an advance slowed by car bombs, highly trained snipers, and a wide range of improvised explosive devices.
Libyan officials now fear such deadly tactics could be used elsewhere, including in the capital Tripoli and other cities in western Libya where Islamic State previously carried out attacks.
"Now they are trapped and it's easy to defeat them, but after they're defeated they'll definitely take revenge," said Fathi Bashagha, a security official who coordinates between Misrata-based forces and the U.N.-backed government in Tripoli.
In the far west, Islamic State could attempt to rebuild around Sabratha, an area used as a training and support hub by Tunisian militants before dozens were killed in a U.S. air strike in February and in later clashes with local forces.
According to a U.N. report published last month, some fighters crossed back to Tunisia following the strike; others found refuge in Sabratha itself or at the foot of the Nafusa mountains to the south. Islamic State "still operates in the region stretching between Tripoli and the Tunisian border, especially in rural areas," the report said.
Within Libya, officials say fugitive fighters from Sirte probably fled south, potentially reinforcing links between Islamic State and militant groups present in the Sahel, including Nigeria's Boko Haram, Al Qaeda in the Islamic Maghreb, Al Mourabitoun and Ansar Eddine.
Hassan Kara, a field commander in Sirte, said senior Islamic State commanders had "fled the battlefield very early on", and that residents in Libya's southwest had reported militants fleeing through the desert toward Niger.
Arnaboldi, the researcher, said he thought reports of escapes from Sirte may be exaggerated. Fighters who managed to leave told him this was only possible for a short period at the start of the battle.
Last month's U.N. report said Islamic State efforts to infiltrate smuggling networks in Libya's southwest had largely failed. But in the southeast the group "struck a deal with Arab armed groups around Al Kufra to protect its convoys", establishing a "small operational presence" in the area.
In the northeast, the spillover from Sirte could fuel a conflict between forces loyal to Khalifa Haftar, a powerful commander who rejects the government in Tripoli, and loose alliances of fighters that include Islamists loyal to Islamic State and al Qaeda-linked Ansar al Sharia.
Some militants from eastern Libya may have returned to their home region from Sirte. The Misrata brigades that approached Sirte from the west did not manage to seal off routes out of the city to the east until June.
"We heard Daesh (Islamic State) were escaping from this side so we moved to close it off," said Ahmed Grayma, a field commander from a Misrata group called Brigade 166 now located on the eastern front.
Haftar's forces have been battling Islamists in the eastern cities of Benghazi and Derna. Though Haftar loyalists have secured large areas in Benghazi, air strikes, bombings and clashes continue in some neighborhoods.
Milad Zway, a spokesman for Haftar's special forces, told Reuters Islamic State had sleeper cells across the east, including in Ajdabiya, close to oil terminals, and Bayda, where the eastern government is located.
Zway said Islamic State and other anti-Haftar militants were "two sides of the same coin". Haftar's opponents say he exaggerates the role of Islamic State among his foes, and many are former anti-Gaddafi rebels with no ties to the militants.
The U.N.-backed Government of National Accord (GNA), which nominally commands the Misrata-led brigades, will get a boost from victory in Sirte, but its bid to create unified security forces and end the conflict has faltered.
While the political divides endure, Libya's factions "could make further use of violent extremist networks in the ongoing political struggle", the U.N. report said.
(Additional reporting by Ayman al-Warfalli and Ahmed Elumami; Writing by Aidan Lewis; Editing by Patrick Markey and Peter Graff)