Islamist gunmen led by one of the world's most wanted terrorists, Isnilon Hapilon, still hold about 1,500 buildings in a southern Philippine city after weeks of ferocious fighting that has left hundreds dead, officials said Monday.

The Philippine military has struggled to expel scores of gunmen who rampaged across Marawi city on May 23 flying the black flag of the Islamic State group, despite day and night artillery and air strikes that have reduced swathes of the downtown area to rubble.

President Rodrigo Duterte last month vowed to "crush" the militants, but several deadlines have already been missed to end a conflict that has left scores dead and forced some 400,000 people from their homes.

In the most detailed assessment yet, Defence Secretary Delfin Lorenzana told the news conference in Manila that there was no saying when soldiers would be able to retake all 1,500 houses and buildings that are held or booby-trapped by the militants.

"Since it is urban fighting a lot of our troops there are not prepared. One can say they are learning as they fight in this built-up area," he said, adding that soldiers are battling street-to-street retaking up to a hundred buildings a day. The military in Marawi suggested a slower rate, with soldiers recapturing 40 buildings on Saturday and 57 on Sunday.

"The clearing operation is difficult because of the presence of IEDs (improvised explosive devices), booby traps left behind by the terrorists," said the military spokesman for the campaign, Lieutenant-Colonel Jo-ar Herrera. Eighty-two soldiers and police and 39 civilians have died in the weeks-long conflict, he said.

Around a hundred militants are still entrenched in the city and the army has said they have used a water route to bring in ammunition and evacuate wounded fighters, helping them withstand the military offensive for weeks. Some 300 gunmen are thought to have been killed so far.

Lorenzana said military commanders wanted a swift end to the operation, "but the enemy is also very wily and resourceful". Duterte imposed martial law over the southern Philippines soon after the fighting started, saying he needed strong powers to snuff out an IS plot to carve out territory after battlefield losses in Iraq and Syria.

A botched government attempt to arrest Hapilon at a Marawi hideout touched off the fighting in May. He is supported by Marawi-based gunmen led by the Maute brothers, whose group has pledged allegiance to IS, as well as several foreign fighters, Lorenzana said.