A Philippine soldier takes aim at militant positions from a rooftop in Marawi on June 13, 2017 © AFP/File Noel CELIS Marawi (Philippines) (AFP) - Islamist militants holding parts of a Philippine city are killing civilians who try to flee while using others as orderlies and cooks, authorities said Tuesday after the gunmen boasted of executions.

There are up to 1,000 people still trapped in the parts of Marawi city that the militants control, the government said, three weeks after fighting erupted with gunmen going on a rampage and flying black flags of the Islamic State (IS) group.

The militants have defied a US-backed military onslaught which has seen relentless bombing of the residential areas of Marawi where they are holed up. Authorities say 400 gunmen are estimated to be still there and using civilians as slaves.

"Based on the revelations of the trapped civilians we have recovered (rescued), they are being used as orderlies to cook their food, to carry their munitions," local military spokesman Lieutenant-Colonel Jo-ar Herrera told reporters.

At least 26 civilians, 58 police or soldiers and 202 militants have been killed, according to the government.

Five of the civilians were killed on Monday as they made a dash for safety when the militants discovered their hiding place, presidential spokesman Ernesto Abella told reporters in Manila.

"They were going to the river but the militants ran after them and indiscriminately fired at them, killing five and taking the remaining eight as hostages," Abella said.

Philippine National Police Special Action Force personnel at a checkpoint in Marawi city, as government troops continue their assault against insurgents from the Maute group, June 10, 2017. Thomson Reuters

IS also released a video on Monday via its Amaq propaganda news agency which it said showed jihadists shooting six Christians in Marawi, according to the US-based SITE monitoring service.

A voiceover suggested further executions had taken place off-camera, SITE reported.

There were tearful scenes in Marawi on Tuesday morning after five Muslim policemen and five Christian construction workers sprinted about two kilometres (1.2 miles) from the militant-controlled areas to safety.

"As we were running, the ISIS fired at us," said Marawi police officer Lumna Lidasan, speaking to reporters in between sobs and using an acronym for an alternate IS name.

Lidasan said the policemen could have left earlier because they were Muslim but they feared for the safety of the construction workers.

"They did not speak Maranao (the local Muslim dialect), so I knew they would have been slaughtered," Lidasan said.

Abandoned city

Marawi is the main Islamic city in the predominantly Catholic Philippines. It is largely abandoned now, with about 250,000 people having fled the city and nearby areas.

Smoke billowing from a burning building is seen as government troops continue their assault on insurgents from the Maute group, who have taken over large parts of Marawi City. Thomson Reuters

The International Committee of the Red Cross (ICRC) said Tuesday it had for weeks been trying without success to persuade both sides to agree to a humanitarian corridor to let the remaining civilians leave safely.

"We're worried about these civilians. There are elderly and sick people among them," Martin Thalmann, the deputy ICRC country chief, told AFP.

President Rodrigo Duterte has said the attack on Marawi was part of a wider plot by IS to establish a base in the southern region of Mindanao, home to 20 million people. He declared martial law across Mindanao the day the fighting erupted.

A Muslim separatist rebellion in the southern Philippines began in the 1970s and killed more than 120,000 people.

A US P3 Orion surveillance aircraft flying over Marawi City as government troops continue their assault against insurgents from the Maute group, who has taken over large parts of the city, June 9, 2017. Thomson Reuters

The main Muslim rebel groups have signed peace accords with the government giving up their separatist ambitions in return for autonomy.

But the militants involved in the Marawi fighting come from a number of small hardline groups that have rejected the peace process and united in recent years under IS.

The are being led by Isnilon Hapilon, who is on a US-government list of most-wanted terrorists and whom the Philippine military says is still in Marawi.

The United States, which is the Philippines' mutual defence partner, has been helping in the battle with American special forces acting as advisers. A US Orion surveillance aircraft has been seen flying over the battlefield.

But the militants have been able to withstand the military campaign partly due to some of their leaders coming from Marawi, and having vital knowledge of underground tunnels and bomb-proof shelters dug in the city decades ago.