philippines soldier
President Rodrigo Duterte on Tuesday announced the liberation of Marawi City, after more than four months of battling ISIL-inspired terrorists.

"Ladies and gentlemen, I hereby declare Marawi City liberated from the terrorist influence that marks the beginning of rehabilitation of the city," Duterte said, abs-cbn reported.

The Philippine flag was raised and soldiers in the strife-torn city cheered "mabuhay" (long live) as Duterte declared the liberation of the city, which was gripped by prolonged conflict that has left more than 1,000 dead and displaced hundreds of thousands.

His announcement came a day after terror leaders Isnilon Hapilon and Omar Maute were killed in a military assault.

But Armed Forces Spokesperson Major General Restituo Padilla Jr. said the killing of the two terrorist leaders "does not signal the end of the hostilities" because as many as 30 terrorists, including 6 to 8 foreigners, remain holed up in the city with some 20 hostages.

"Our troops have remained in the battle area continuing to pursue the armed elements and seeking to rescue the remaining hostages in about two hectares of space that remains to be the battle area," Padilla added.

Padilla said Marawi residents would not be allowed to immediately return to their homes to avoid deaths from improvised bombs scattered in some parts of the city.

"After all, having survived several months in evacuations centers, it would be [ironic] if upon the return of a resident in Marawi, they would suffer because of an IED that was left," Padilla added.

Meanwhile, Presidential Spokesperson Ernesto Abella appealed to the remaining terrorists to surrender and "return to the road of peace."

"With terrorist leaders gone, we call on all fighters to cease further resistance and violence and return to the road of peace," Abella stressed.

Parts of the Muslim-majority city, on the Southern Philippines island of Mindanao, had been under the control of the Maute group since a shock invasion by militants at the end of May.

The violence forced more than 350,000 residents to flee the city and the surrounding areas, as their homes were reduced to rubble by airstrikes and militant fire.