Troops backed by attack helicopters battled dozens of militants linked to the Islamic State group holed up in a besieged city in the southern Philippines, on Thursday, after attempts to secure volatile areas met heavy resistance.

The army sent about 100 soldiers, including US-trained special forces, to retake buildings and streets in mainly Muslim Marawi City held by militants of the Maute group, which has pledged allegiance to Islamic State.

Thousands fled as rebels seized large parts of the city and torched buildings in running battles with government forces that erupted on Tuesday afternoon after a failed raid by security forces on one of the group’s hideouts.

Philippine President Rodrigo Duterte imposed martial law on impoverished Mindanao, the country’s second-largest island, to prevent the spread of extremism after the Maute rebels rampaged through the city of 200,000 people.

At least 21 people have been killed since then. Religious leaders have also accused the rebels of using Christians, taken hostage during the fighting, as human shields.

“We’re confronting maybe 30 to 40 remaining from the local terrorist group,’’ said Jo-Ar Herrera, a spokesman for the military’s First Infantry Regiment.

“The military is conducting precise, surgical operations to flush them out … The situation is very fluid and movements are dynamic because we wanted to out-step and out-maneuver them,” he said.

Islamic State claimed responsibility late on Wednesday for Maute’s activities via its Amaq news agency.

Hostilities had eased overnight but flared again later on Thursday morning when troops advanced towards a strategic bridge held by Maute fighters.

The military sent in two helicopters with machine guns to flush out rebels and take control of the bridge, one of three operations in the city.

Trucks were being sent to evacuate any remaining civilians. A total of seven government troops, 13 militants and one civilian had been killed since Tuesday, Herrera said.

Marawi is located in Lanao del Sur province, a stronghold of the Maute, a fierce, but little-known group that has been a tricky opponent for the military.

Hundreds of civilians, including children, were sheltering in a military camp in Marawi City on Thursday. The Maute had taken more than a dozen Christians hostage and set free 107 prisoners from two jails since Tuesday.

Bishops and cardinals had pleaded with the Maute rebels, who they said were using Christians and a priest as human shields. The status of the captives was unknown.

Human rights groups are concerned about possible abuses by the military and police in places under martial rule, but Duterte has insisted he will not allow that to happen. (NAN)