SIRTE, Libya (Reuters) - Sheltering in tunnels, improvised bunkers and rooms fortified by sand-filled fridges, Islamic State is holding out in the Libyan city of Sirte, defending itself with snipers, booby-traps and car bombs against pro-government forces.
After a six-month campaign of often fierce street fighting, Islamic State militants are surrounded in a district less than one-kilometer square, after hundreds of U.S. air strikes that began in August in support of Libyan forces.
The battle for Sirte, taken by Islamic State more than a year ago, may be over soon. But how the militants managed to survive may give insight into the kind of tactics they could use to defend other cities.
The fall of Sirte would mean the loss of the militant organization's main stronghold outside Iraq and Syria just as a U.S.-led alliance supports Iraqi forces moving to retake the city of Mosul, its main base in Iraq.
Sirte fell to Islamic State as the militants profited from infighting among Libyan factions to gain territory, steadily taking the city and imposing their hardline vision on Muammar Gaddafi's former home town.
A U.N.-backed government is now in Tripoli trying to unite Libya's competing factions of armed brigades who once battled together to oust Gaddafi in 2011, but have since turned against one another.
Six months ago, powerful brigades from the nearby city of Misrata began a campaign to flush the militants out of Sirte, which posed a direct threat to their city.
In the early days of the battle, Misrata forces suffered heavy casualties from snipers. More than 500 Misrata fighters have been killed, many by gunshots as they pushed in from the city outskirts.
Fighting has ebbed and flowed along with casualties as Misrata forces slowly encircled the last districts under Islamic State control, leading militants to change to more hit-and-run tactics, car bombs and explosive devices.
Some Misrata commanders said progress had been slowed by snipers and explosive devices left behind, but also by a lack of weapons and hospital facilities, especially when heavy fighting led to casualties in double digits.
But U.S. air strikes since August have targeted car bombs and militant firing positions, allowing progress. Western special forces teams are advising on the ground as well as providing forward air controllers who guide air strikes.
"Each round of fighting has its own circumstances ... and it's difficult to predict when the battle will be over. But the end of Daesh will be very soon," said Mohammad Ghasri, a spokesman for pro-government forces, using an Arabic name for Islamic State.
With Misrata forces closing around the city center midway through the campaign, militants at first appeared to be holed up in the Ouagadougou conference hall, a central complex once used by Gaddafi for African summits.
As U.S. air strikes intensified, militants pulled back into dense residential neighborhoods as the battle destroyed much of the city. But it has been a fighting withdrawal, taking a toll on Libyan forces.
At the end of August, 35 Misrata brigade fighters were killed as their forces moved forward several hundred meters among emptied residential blocks in neighborhood Number One, near the sea front.
Now with less than one square kilometer under their control, militants have the sea front on one side and Misrata forces all around them, controlling high ground over part of the 600 district and the Ghiza Bahriya area, witnesses said.
Abandoned houses have revealed some of their defenses: Household fridges packed with earth act as reinforcements, and bunkers dug under foundations offer protection from air strikes.
Last week, Misrata forces found improvised tunnels and a makeshift field hospital. A Reuters witness said that in one house graffiti on the walls indicated a quick escape route for the next fighter to use that hideout.
Improvised bombs made from fragmentation grenades and rocket shells are common traps. Garages often contain unexploded car bombs, a Reuters reporter on the ground said. Suicide belts are sometimes left behind by fleeing fighters.
Misrata forces have also been increasingly using tanks and heavily armored vehicles to approach buildings, blasting a way ahead before brigade fighters, some often in flip flops and jeans, make their way in to clear them.
On Thursday, five foreign captives - two Turks, two Indians and a Bangladeshi - were freed after fighting that killed 20 Islamic State militants. Losing captives may be a sign of the group coming under more pressure. But it also makes Misrata forces cautious.
"Sometimes the battle takes a long time because we face unexpected situations like civilians being detained," Rida Issa, another spokesman said. "The battle is now in residential areas and that means tough, street-by-street fighting."
How many militants are left in Sirte is unclear. At the start of the campaign, some estimates said as few as 600 fighters remained. Some commanders and militants may have already fled before Sirte was encircled, Misrata officials say.
That has raised the risk of guerrilla attacks. Already a suicide bomber has hit a field hospital outside the city. This week more roadside bombs were found near a field hospital and a helicopter landing area 5 km (3 miles) outside Sirte, witnesses said.
Reporting by Ismail Zitouni and Ahmed Elumami in Tripoli; writing by Patrick Markey; editing by Giles Elgood