SIRTE, Libya (Reuters) - Libyan forces backed by U.S. air strikes finished clearing the last Islamic State holdout in Sirte on Tuesday after a near seven-month battle for the militant group’s former North African stronghold.

The forces gained full control over a final patch of ground in Sirte’s Ghiza Bahriya district after hours of clashes. Several dozen women and children who had been holed up with the militants were able to leave the ruined buildings where they had made their last stand.

As celebrations erupted among the Libyan forces, which are dominated by brigades from the city of Misrata, a spokesman said the military campaign would continue until the wider area was secured.

Fighters fired in the air chanting “Free Libya” and “The blood of the martyrs was not for nothing.”

The loss of Sirte is a major blow for Islamic State, leaving the group without any territory in Libya, though it retains an active presence in parts of the vast country.

The jihadist group took over Sirte in early 2015, turning it into their most important base outside the Middle East and attracting large numbers of foreign fighters into the city. It imposed its ultra-hardline rule on residents, and extended its control along about 250 km (155 miles) of Libya’s Mediterranean coastline.

Spokesman Rida Issa said although forces had “secured all the buildings and the streets” in Ghiza Bahriya, this did not mean the end of the Misrata-led operation. “We still need to secure the area around Sirte,” he said.

French Defence Minister Jean-Yves Le Drian said: “This is very good news. The defeat of Daesh (Islamic State) is a very strong act, but it can only be seen as a step ... the militias that have freed Sirte deserve to be congratulated.”

Libyan and Western officials say some Islamic State fighters escaped from Sirte before the battle or in its early stages. They fear an insurgent campaign from outside the city and there have been attacks in outlying areas.

BOMBERS, SNIPERS, MINES

The Misrata-led forces counterattacked in May after jihadists moved along the coast toward their city. The brigades, nominally aligned with a U.N.-backed government in Tripoli, advanced rapidly toward the center of Sirte before suicide bombers, snipers and mines largely halted their progress.

More than 700 of their fighters have been killed and more than 3,200 wounded in the grueling campaign.

On Tuesday, a further three men were killed and about 50 wounded, said Mohamed Lajnef, an official at Sirte’s field hospital. He also said 21 women and 31 children had been released in Ghiza Bahriya.

Slideshow ( 10 images )

Dozens of other women and children - some of them migrants from sub-Saharan Africa held captive by Islamic State - had escaped or had been released from militant-held ground in recent days.

Mohamed al-Ghasri, another spokesman for the military operation, said there had been two attempted suicide bombings on Tuesday, including one by a woman, and that more than 30 militants’ bodies had been counted in the rubble.

Since Aug. 1, the United States has carried out at least 495 air strikes against Islamic State in Sirte.

Slideshow ( 10 images )

Libya remains in turmoil over five years after the revolution that toppled Muammar Gaddafi. The U.N.-backed Government of National Accord (GNA) that arrived in Tripoli in March and supported the campaign in Sirte has made little progress in ending the chaos.

Sirte lies in a strategic position about halfway along Libya’s coastline, near some of the country’s major oil fields and terminals. Close to Gaddafi’s birthplace, it is also the city where he was shot and killed after ruling Libya for 42 years.

Almost all of Sirte’s estimated population of 80,000 fled the city since Islamic State took over. Ghasri appeared on television asking local families not to return until mines had been cleared.