President Rodrigo Duterte announces the liberation of Marawi from local and international terrorists. Malacañang Photo

MANILA (UPDATED) - President Rodrigo Duterte on Tuesday announced the liberation of Marawi City, after more than four months of battling Islamic State-inspired terrorists.

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

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 Restituto 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 said.

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 said.

“This is also the call of our Muslim leaders, our imams, ARMM, MNLF, MILF chiefs, and the leaders of Muslim nations and this is the plea of your families, friends, and communities. Let us restore peace and rebuild our land,” Abella added.

LONG ROAD TO LIBERATION

The conflict, the biggest security challenge that state forces had to face in years, broke out on May 23 and prompted President Rodrigo Duterte to place the entire Mindanao under martial law.

The incident also showed the depth of ISIS-inspired extremism in the restive south and the extent of terrorists' resources to mount months of resistance.

The crisis left much of the once urban and cultural center in ruins, with buildings either burned to the ground or damaged in firefights.

It also spawned a humanitarian crisis with more than 400,000 displaced from Marawi and nearby towns, many crammed in evacuation centers and temporary shelters.

REJECTED TALKS

Throughout the battle, government remained firm in rejecting possible negotiations with terrorists even after the capture of the parents of terror leaders Abdullah and Omar Maute.

Early on, Abdullah reportedly offered to release one of his group's hostages, Fr. Chito Suganob, in exchange for the release of his parents, Farhana and Cayamora.

Cayamora, who was detained at the Special Intensive Care Area in Camp Bagong Diwa in Taguig, died in August due to several illnesses.

Suganob meanwhile was eventually rescued early in September after being held hostage for over 4 months.

President Duterte also kept the morale of his troops, visiting Marawi and camps around the area several times throughout the crisis.

Several countries and organizations have provided aid for state troops and rebuilding efforts in the battered city, among them the United States, China, Australia, Japan and the European Union.

Duterte has ordered the creation of a task force for the rehabilitation of Marawi with an initial allocation of P20 billion.

The government has estimated the rebuilding of the city to take around 2 to 3 years.

-- Raphael Bosano, Dharel Placido, ABS-CBN News