The Philippines has declared victory over supporters of the Islamic State of Iraq and the Levant (ISIL) group in the southern city of Marawi.

Five months of urban combat left 920 fighters dead and cost the lives of 165 government soldiers and at least 45 civilians.

The government had teamed up with its former enemies from the Moro Islamic Liberation Front in its attempts to snuff out the fighters.

Fighting ended when troops finally overcame pro-ISIL fighters, including foreigners, who were holed up in several buildings in the heart of the city.

Officials say martial law will continue to be implemented in the wider Mindanao area.

The end of the clashes gave way to scenes of a historic city in ruins with soldiers patrolling the gutted out and pockmarked remains of apartment blocks and houses.

Pictures taken after the battle reveal it devastating impact; buildings turned to rubble, cars dotted with bullet holes, and personal belongings and furniture heaped beside the shell of a row of houses.

More than 600,000 locals were displaced by the fighting.

The siege of Marawi and the later battle started when officials tried to serve an arrest warrant in May to Isnilon Hapilon, a commander in the Abu Sayyaf group, and Omarkhayam Maute of the Maute group.

Instead of giving up their arms, Hapilon formed an alliance with the Maute Group and launched a bloody rampage in the city.

Hapilon then declared his allegiance to the ISIL group, drawing support from foreign fighters from nearby Malaysia and Indonesia.