MARAWI, Philippines -- Philippine fighter aircraft unleashed rocket fire against militants on Saturday, prompting villagers to hoist white flags to avoid being targeted as the military turned to airstrikes to try to end the siege of a southern city by Islamic State group-allied militants.

The predominantly Muslim city of Marawi, home to some 200,000 people, has been under siege since a failed army raid Tuesday on a suspected hideout of Isnilon Hapilon, who is on Washington's list of most-wanted terrorists.

Hapilon got away and fighters loyal to him took over parts of the city, burning buildings, taking cover in houses and seizing about a dozen hostages, including a Catholic priest. Their condition remains unknown.

At least 48 people have died in the fighting, including 35 militants and 11 soldiers, officials say, adding that an unspecified number of civilians are feared to have died.

While up to 90 per cent of Marawi's people have fled amid the fighting, many who were trapped or refused to leave their homes have impeded military assaults, officials said. That has slowed efforts to end the most serious crisis President Rodrigo Duterte has faced since he took power nearly a year ago.

"In as much as we would like to avoid collateral damage, these rebels are forcing the hand of government by hiding and holding out inside private homes, government buildings and other facilities," the military said in a statement.

"Their refusal to surrender is holding the city captive," it said. "Hence, it is now increasingly becoming necessary to use more surgical airstrikes to clear the city & to bring this rebellion to a quicker end."

The violence prompted Duterte on Tuesday to declare 60 days of martial law in the southern Philippines, where a Muslim separatist rebellion has raged for decades. But the recent violence has raised fears that extremism could be growing as smaller militant groups unify and align themselves with the Islamic State group.

Hapilon's group has received a "couple of million dollars" from the Islamic State group, Defence Secretary Delfin Lorenzana told reporters without elaborating Friday.

As air force planes and rocket-firing helicopters pounded militant positions on Saturday, fleeing residents waved white flags or hoisted them on their roofs to signify that they are not combatants.

"I saw two jets swoop down and fire at rebel positions repeatedly," Alexander Mangundatu, a security guard, told The Associated Press in Marawi as a plume of black smoke billowed from a distant commercial area that was hit. "I pity the civilians and the women who were near the targeted area. They're getting caught in the conflict and I hope this ends soon."

Military spokesman Brig. Gen. Restituto Padilla said government forces are working to "clear the city of all remnants of this group."

Some civilians refused to evacuate because they want to guard their homes, slowing down the government operations, he said.

"But that's fine as long as civilians are not hurt," Padilla said.

On Friday, Duterte ordered his troops to crush the militants, warning that the country is at a grave risk of "contamination" by the Islamic State group.

Duterte told soldiers in Iligan, a city near Marawi, that he had long feared that "contamination by ISIS" loomed in the country's future, using the acronym for the Islamic State group.

"You can say that ISIS is here already," he said.

Lt. Gen. Carlito G. Galvez Jr., a military commander, said about 150 trapped civilians have been rescued by troops from their homes, adding the militants were burning houses to distract troops. The gunmen were still holding out in two areas and soldiers have begun door-to-door searches.

As troops intensified their assaults, Galvez apologized to Muslim residents over the disruption during the holy fasting month of Ramadan.

Hapilon, who was recovering from wounds inflicted by an airstrike in January, is still hiding out in the city under the protection of gunmen who are desperately trying to find a way to extricate him, said Philippine military chief Gen. Eduardo Ano. Hapilon has also suffered a mild stroke, he said.

Ano predicted that the military operation would take about a week as soldiers go house to house to clear the city of militants.

In a sign that the long-standing problem of militancy in the south could be expanding, Solicitor General Jose Calida said foreigners, including Indonesians and Malaysians, were fighting alongside the gunmen in Marawi.

Ano said foreign fighters were believed to be inside, but he was more cautious. "We suspect that, but we're still validating," he said.

Hapilon is one of the most senior commanders of the Abu Sayyaf, which is notorious for kidnappings for ransom, beheadings and bombings. He pledged allegiance to the Islamic State group in 2014. He also heads an alliance of at least 10 smaller militant groups, including the Maute, which has a presence in Marawi and was instrumental in fighting off government forces in this week's battles.

Washington has offered a $5 million reward for information leading to Hapilon's capture.