A Philippine bomber plane accidentally killed 11 soldiers and injured seven others, security officials said Thursday, as troops struggled to end a bloody siege by 500 Islamic State group-aligned extremists in a southern city, one of the boldest militant attacks in Southeast Asia in years.

The plane was making a bombing run over militant positions in Marawi city on Wednesday when one bomb accidentally hit army troops locked in close battle with extremists who had taken cover in buildings and houses, military spokesman Brig. Gen. Restituto Padilla said. The plane had made three successful bombing runs before making the error, he said.

"It's painful, it's very sad to be hitting our own troops," Defense Secretary Delfin Lorenzana told a news conference in Manila. "Sometimes, in the fog of war, a lot of things could happen."

Precision-guided bombs were used earlier in airstrikes in Marawi's urban areas, but the military ran out of the high-tech munitions and used conventional ones in Wednesday's bombing run, he said.

Military chief of staff Gen. Eduardo Ano ordered an investigation.

Lorenzana said about 500 militants, including foreign fighters, joined the siege of Marawi, a mosque-studded city that is the heartland of the Islamic faith in the southern Philippines.

About 50 to 100 militants were putting up the strongest stand in buildings across a bridge from Marawi's city hall, where hundreds of reinforcement troops were deployed. Snipers and buildings that obstructed cannon fire were making it difficult for troops to end the siege, said Lorenzana, who had wanted to end the crisis by Friday.

A total of 120 militants have been killed in the fighting since May 23, when a failed government raid to capture one of Asia's most-wanted militants, Isnilon Hapilon, triggered the siege of the city by the rebels. Twenty-five of the dead militants have been identified as Filipinos, according to military officials. Eight others were foreign fighters, including a Chechen, a Yemeni and several Malaysians and Indonesians, Lorenzana said.

President Rodrigo Duterte said he ordered troops to "wipe them out, everyone."

"If you shoot him in the head, shoot him again in the heart to be sure," the tough-talking Duterte said in a speech.

At least 25 soldiers, five policemen and more than 24 civilians have been killed in the clashes, Lorenzana said.

Duterte declared martial law in the Mindanao region, the southern third of the Philippines, to crush the insurrection, and poured in troops backed by airstrikes, artillery fire and armored vehicles. More than 3,000 soldiers, marines and air force personnel are involved in the fighting, backed by more than 30 assault aircraft, military officials said.

The unrest has boosted fears that the Islamic State group's violent ideology is gaining a foothold in the country's restive southern islands, where Muslim separatist rebellions have raged for nearly half a century.

"This thing that we see today is the first time that any terror organization in Southeast Asia has taken the bold step to actually overtake an entire territory," said Jasminder Singh, a senior terrorism analyst at the S. Rajaratnam School of International Studies in Singapore.

He said the siege "will actually become more of a template and motivation for other terrorist organizations who believe they can actually take on government forces."

Officials said troops have cleared about 90 percent of Marawi, a scenic lakeshore city with a population of more than 200,000, many of whom have fled to crowded evacuation camps in outlying towns. About 2,000 people are believed to still be trapped in houses near the fighting, while about 1,000 others have been rescued by police and soldiers from villages that have been cleared of armed extremists, the officials said.

The squalor in the shelters, lack of privacy and shock of the violence moved some displaced residents to tears.

Okie Rasul, a fruit vendor and mother of eight, blamed the militants for the uncertainties her family now faces. They fled their home last week amid the horrifying staccato of gunfire and explosions, leaving behind 10,000 pesos ($200) worth of fruit for their business that she bought with a loan.

"We lost everything, our home and my business," Rasul told the AP as she waited to receive a pack of food and water in an overcrowded emergency shelter in Balo-i town near Marawi. "The only things we saved are the clothes we're wearing, but at least we're all alive."

___

Associated Press journalists Teresa Cerojano in Manila and Kiko Rosario in Singapore contributed to this report.