Tens of thousands of people have fled clashes raging through residential neighbourhoods in Marawi.
Tens of thousands of people have fled clashes raging through residential neighbourhoods in Marawi, one of the biggest Muslim cities in the mainly Catholic Philippines, with cars choking roads out of the area.
President Rodrigo Duterte imposed martial law across the southern region of Mindanao on Tuesday, hours after gunmen loyal to the Islamic State group rampaged through the city in response to a raid on one of their safe houses.
"You can see that ISIS is here already," Duterte said in a speech Friday at a military camp near Marawi, referring to the militant group by another acronym, as officials said the insurgents were from multiple countries.
Six foreign fighters were believed to have died in the bloodshed, according to Philippine military spokesman Brigadier-General Restituto Padilla, including Malaysians, Indonesians and another nationality which he did not specify. Another government official listed Singaporeans as also among the militants.
Padilla said 11 soldiers, two policemen and 31 militants had been confirmed killed in the fighting, which has involved the military bombing buildings where the militants have been hiding.
Two civilians were also killed inside a hospital that the gunmen had occupied on Tuesday, and the military was investigating reports that nine people had been murdered at a checkpoint the militants had set up, authorities said.
The fighting erupted on Tuesday after security forces raided a house where they believed Isnilon Hapilon, a leader of the infamous Abu Sayyaf kidnap-for-ransom gang and Philippine head of IS, was hiding.
The United States regards Hapilon as one of the world's most dangerous terrorists, offering a bounty of $5 million for his capture.
The raid went spectacularly wrong as dozens of gunmen emerged to repel the security forces, then tore across the city while flying black IS flags.
Authorities said ending the crisis was proving extremely hard because the militants, even though they were believed to number only in the dozens, had planted bombs in the streets and were holding hostages.
They said militants had also occupied higher ground in the city, enabling them to slow down or stop assaults from the security forces.
Snipers fired on Friday afternoon at about 100 troops who were marching single-file uphill through one district of Marawi that the militants had previously controlled, according to journalists accompanying the soldiers.
The troops pulled down a black IS flag that had been raised on top of one house, then set up position as the gunfire from uphill intensified.
Duterte said the militants belonged to the Maute group that has emerged only in recent years in Mindanao and gained strength on the proceeds of drug money.
The group had 263 armed followers at the end of last year, according to Duterte's report to Congress to justify martial law, which was released to the media on Friday.
Muslim rebels have been fighting since the 1970s for an independent or autonomous homeland in Mindanao, with the conflict claiming more than 120,000 lives.
The main Muslim rebel groups are now involved in peace talks with the government.
But the Abu Sayyaf, Maute and other hardline groups want to set up an Islamic caliphate in the south for IS, according to Duterte.
Security analysts have also warned that the threat and influence of the hardline groups has been rising in recent years as they have banded together behind the IS flag.
But some critics of Duterte say he might be exaggerating the IS threat to justify a form of authoritarian rule that will give him greater powers to prosecute his controversial crackdown on drugs, which has claimed thousands of lives.
One of his most important political allies, ex-president Fidel Ramos, said Friday that martial law across Mindanao was not justified, and called for it to be quickly revoked.