The terrorists now occupy just five acres of territory

Gunfire rang out sporadically and explosions thudded as Philippine soldiers fought Tuesday to regain control of the last pocket of Marawi controlled by Islamic militants, with President Rodrigo Duterte declaring the southern city liberated from “terrorist influence.”

The military, boosted by the deaths of two key militant leaders the day before, hopes the fighting is the final phase of defeating a dwindling band of fighters who are now trapped in an area the army says is about 2 hectares (5 acres).

Duterte visited the battle-scarred city on Tuesday where, to cheers from rain-drenched troops, he announced its liberation in a speech from a stage at a ruined school campus about a kilometer (half a mile) from the fighting.

“Ladies and gentlemen, I hereby declare Marawi city liberated from the terrorist influence,” he said.

Beside the stage, a large banner displayed photos of the slain militant leaders. Duterte and the troops later saluted as Taps was played amid a downpour to honor more than 160 soldiers and policemen who perished in the violence.

Military chief Gen. Eduardo Ano told The Associated Press that Duterte’s statement means the threat from the militants, who have occupied parts of the lakeside city for five months, is substantially over.

“They’re leaderless and they have no more organization,” he said. “There are still skirmishes.”

According to military spokesman Restituto Padilla, there are 20 to 30 militants left in Marawi, including six to eight foreign fighters. They have about 20 hostages, including women and children, he said. As many as 80 small buildings and homes will need to be swept for explosives.

Marawi, a mosque-studded center of Islamic faith in the predominantly Roman Catholic Philippines, has been devastated by the siege laid by the Islamic State group-allied militants who overran the city on May 23. More than 1,000 people have been killed, including at least 847 militants, according to the military.

The thousands of troops securing the city will be reduced, although a sizable number will be left behind to keep watch, especially when residents return to rebuild their communities, military officials said. The remaining gunmen may now be considered a police concern, they said.

The surprise occupation of the city and the involvement of foreign fighters set off alarms in Southeast Asia and the West. Analysts said parts of the southern Philippines were at risk of becoming a new base for IS as it lost territory to international forces in Iraq and Syria.

Philippine flags hung Tuesday from pockmarked buildings and houses in Marawi, their roofs either blasted away or riddled with gunshot holes.

Soldiers stood guard in front of some buildings and at intersections where battle debris had been shoveled to the side.

The government on Monday confirmed an Associated Press report that two key figures behind the siege — Isnilon Hapilon, who is among the FBI’s most-wanted terror suspects, and Omarkhayam Maute — were killed in a gunbattle.

A top Malaysian militant, Mahmud bin Ahmad, who uses the nom de guerre Abu Handzalah and is a close associate of Hapilon, has not been found and is among the remaining militants being hunted by troops.

At a public hall converted into an evacuation center just outside Marawi, there was joy among evacuees at news of the two men’s deaths and hopes of a return to some form of normality.

Evacuees chatted about the news and looked at Facebook posts showing pictures of the dead Hapilon and Maute.

“We’re very happy because they have lost their leaders. I hope that all of them will be wiped out,” said Seima Munting, a 40-year-old mother of four who is among 750 people living at the hall in Balo-i township.

“My brother told me that finally we can return home, but when? When can we finally return home? What will we return to? Do we still have a house? Do we have jobs?” she said.

In the squalor of evacuation centers, some women have given birth, personal milestones that mark a tragic time. Saliha Mama said she gave birth to a baby girl in an open wooded area while escaping from the gunfire and explosions the day after the Marawi siege began.

Now a bouncy 4-month-old, the baby giggles in a cloth hammock as Mama keeps watch, struggling to smile as she speaks of the many uncertainties her family faces even if the crisis in her city finally ends.