A five-month battle against Islamic State supporters in the southern Philippines that claimed more than 1,100 lives has ended following a final battle inside a mosque, defense chiefs said on Monday.
The conclusion of the conflict ended immediate fears that IS would establish a Southeast Asian base in the southern city of Marawi. But concerns remained about its longer-term intentions and capabilities for the region.
"We now announce the termination of all combat operations in Marawi," Defense Secretary Delfin Lorenzana told reporters on the sidelines of a regional security meeting in Clark, a northern Philippine city.
"There are no more militants inside Marawi city."
Hundreds of local and foreign gunmen who had pledged allegiance to IS rampaged through Marawi, the principal Islamic city in the mainly Catholic Philippines, on May 23. They then took over parts of the city using civilians as human shields.
An ensuing U.S.-backed military campaign claimed the lives of at least 920 militants, 165 soldiers and 47 civilians, according to the military.
More than 400,000 residents were displaced as near-daily air strikes and intense ground combat left large parts of the city in ruins.
Philippine President Rodrigo Duterte travelled to Marawi on Tuesday last week and declared the city had been "liberated", a day after the Southeast Asian leader for IS, a Filipino militant named Isnilon Hapilon, was shot dead there.
However the continued fighting in subsequent days raised questions over whether the city was indeed free of militants.
"The presence of the Maute-ISIS was confined to two buildings: one of them a mosque," armed forces chief General Eduardo Ano told reporters on Monday as he explained the situation in Marawi following Duterte's liberation proclamation.
"That is where the last fighting occurred and that is the place where we rescued (an) additional 20 hostages.
"In that fighting, we gave the chance for these militants and terrorists to surrender. But they fought to the last breath so we had no choice."
The bodies of 42 militants were recovered after the final battle, including two women and five foreigners, according to Ano, who spoke at the same briefing as Lorenzana in Clark.
Hiding in basements, mosques
Hapilon, who was on the US government's list of most wanted terrorists, was killed along with one of group's other leaders, Omarkhayam Maute, according to the military.
The militants had been able to defy the relentless bombing raids that destroyed entire neighbourhoods by sheltering in basements and travelling through tunnels, according to the military.
The military had also said its opponents hid inside mosques, and that soldiers had been ordered not to bomb or fire artillery at such buildings.
The Philippines' Muslim minority regards the southern Philippines as its ancestral homeland.
Muslim rebels have been battling in the south since the 1970s for independence or autonomy, with that conflict claiming at least 120,000 lives.
The nation's biggest Muslim rebel group, the Moro Islamic Liberation Front, is in talks with the government to end the rebellion, and its leaders regularly denounce IS.
But there are more extreme groups with no interest in peace, some of which were originally part of the MILF.
Hapilon and Maute led small armed groups that declared their allegiance to IS in recent years, and they formed an alliance aimed at taking over Marawi and establishing a regional caliphate for the Middle East-based jihadists.
Duterte imposed martial law across the southern third of the Philippines immediately after the Marawi fighting erupted, saying it was needed to contain IS's influence spreading throughout the region.
When asked on Monday whether marital law would be lifted, Lorenzana said a decision had not yet been made.
U.S. Defense Secretary James Mattis on Monday praised the Philippines for its success.
"One of the first things I'm going to do when I get there is commend the Philippine military for liberating Marawi from the terrorists," Mattis told reporters on board a flight to the Philippines to attend the security meeting in Clark.