MANILA (Reuters) - Troops in the southern Philippines retook a disused building from Muslim militants on Wednesday, ending an intense five-day siege that killed dozens of fighters the authorities say had pledged allegiance to Islamic State.

Slideshow ( 4 images )

The incident highlights the challenges facing President Rodrigo Duterte in keeping order in the Philippines, particularly in his native south, riven by nationalist rebellions for decades.

The military stepped up its offensive after the weekend, pounding rebels holed up in a disused municipal hall with artillery and bombs dropped from aircraft. The army said 30 security forces were wounded and 61 rebels killed in the operation.

The militants belonged to the Maute group, one of several Islamist groups in the country’s restive south.

The siege ended as Duterte visited injured soldiers in Lanao del Sur province, where seven of his advance security party were wounded on Tuesday, when suspected Maute militias set off a bomb under their truck.

“The town is deserted and the Maute is withdrawing towards the mountain,” said military spokesman Brigadier-General Restituto Padilla.

“They have been decimated. The capability to sustain and get back to the fight is no longer there.”

The government suspects the Maute group in a Sept. 2 bombing in Duterte’s home city, Davao, which killed 14 people and wounded more than 70.

Last week Duterte appealed to the Islamic State-linked Abu Sayyaf to disarm and start talks. He urged them to halt piracy and kidnapping and not retaliate on civilians for military operations to drive the rebels from their island strongholds.

Duterte has recently warned Islamic State could take root in the Philippines and stressed the need to avoid “contamination”, a risk also faced by neighboring Malaysia and Indonesia..

The former mayor, who is overseeing a drugs crackdown that has killed more than 2,500 people, offered an olive branch to Maute, questioning why it wanted to take orders from Islamic State.

“Maute, they are inspired by ISIS,” Duterte said in a speech, using an abbreviation that refers to Islamic State. “I did not want to wage a war against my own countrymen. Please do not force my hand.”

But he vowed not to relent.

“When the time comes, it’s going to be a war against terrorism and drugs and I will tell you now, I will be harsh,” Duterte said. “As harsh as I can ever be.”

Separately, two men were arrested on Monday north of the capital, Manila, over the planting of a homemade bomb near the U.S. embassy. The device was detonated safely by police, who suspect the Maute of being behind it.