After Libyan forces finished clearing Islamic State (Isis/Daesh) fighters out of Sirte, several dozen women and children who had been holed up with the militants were able to leave the ruined buildings where the extremists had made their last stand.

Sirte Libya Isis
A fighter of Libyan forces allied with the UN-backed government carries a boy after they rescued him from Islamic State-held territory in Ghiza Bahriya Hani Amara/Reuters

The forces gained full control over a final patch of ground in Sirte's Ghiza Bahriya district after hours of clashes, concluding an almost seven-month battle for the militant group's former North African stronghold.

Mohamed Lajnef, an official at Sirte's field hospital, said 21 women and 31 children had been released in Ghiza Bahriya. Dozens of other women and children – some of them migrants from sub-Saharan Africa held captive by Isis – had escaped or had been released from militant-held ground in recent days. "I was scared to go out, but then I did, thinking I'll surrender myself and I'll go out, so they secured me and we went out. Thank goodness," a woman who said she was the wife of an Isis fighter, told Reuters.

The presence of the families had been one of the factors complicating attempts to push forward into the final sliver of land held by Islamic State, and several women carried out suicide attacks as they were being granted safe passage.

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.

Daesh imposed its ultra-hardline rule on residents, and extended its control along about 250km (155 miles) of Libya's Mediterranean coastline.

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.