MANILA - The Philippine military said Bangsamoro Islamic Freedom Fighters (BIFF) gunmen fled from a primary school in the south on Wednesday, leaving behind 31 hostages unharmed, including 12 children, after a day-long gunbattle with troops.
There was no word of casualties in the incident at Pigcawayan town, which is about 190 km (120 miles) south of Marawi City, where fighting between government troops and pro-Islamic State militants has entered its fifth week.
"The enemy made a hasty withdrawal, leaving behind 31 hostages, among them 12 youngsters," Brigadier General Restituto Padilla told Reuters.
He said another 20 civilians who were trapped in the area because of the crossfire were also rescued.
Army 6th Infantry Division spokesman Capt. Arvin Encinas confirmed the release late Wednesday night, saying all of the hostages were freed around 6 p.m.
He earlier said the BIFF were still holding less than 10 civilian hostages at around 7 p.m.
Police said about 300 armed men from the BIFF stormed the school early on Wednesday. Padilla, however, said later only about 50 militants were involved.
Military officials were initially not certain if any hostages were taken and whether they included children.
Community leaders in the area were called in to help in negotiations to rescue the hostages, Padilla said.
"It's over ... but we're also on guard because they might carry out other attacks," said Padilla.
Abu Misry Mama, a spokesman for the BIFF, told Reuters that the militants had taken civilians to a safe place, away from any crossfire, and did not intend to hold them hostage.
Asked earlier if they would be freed, Mama said: "Yes. We're not kidnappers."
Both Pigcawayan and Marawi are on the large southern island of Mindanao.
Some members of the BIFF have joined fighters from two more powerful Islamist factions, the Maute group and Abu Sayyaf, who occupied the town of Marawi a month ago and have been battling government forces there since.
But Padilla said the incident at Pigcawayan was not related to the fighting in Marawi. "This has come from a group that has long committed harassments," he said.
The seizure of Marawi and the dogged resistance by the rebels there who have pledged allegiance to Islamic State has alarmed Southeast Asian countries.
Government fear Islamic State, on a backfoot in Iraq and Syria, is trying to set up a stronghold in the Muslim south of the mainly Roman Catholic Philippines that could threaten the whole region. - with reports from Reuters