Foreign fighters were among local gunmen clashing with the Philippine army in Mindanao island, authorities said on Friday, in a rare admission that outsiders were collaborating with domestic groups.

Military officials said Malaysians and Indonesians were among six killed on Thursday in battles that have raged for four days in Marawi City, where the army has been trying to flush out rebels of the Maute and Abu Sayyaf armed groups, which are linked to Islamic State of Iraq and the Levant (ISIL, also known as ISIS).

The Philippines has deployed attack helicopters and special forces to drive the gunmen out of the besieged southern city of 200,000 people, with at least 11 soldiers and 31 fighters killed.

"Before it was just a local terrorist group. But now they have subscribed to the ideology of ISIS," Solicitor General Jose Calida told a news conference. "They want to make Mindanao part of the caliphate."

READ MORE: Mindanao - Churchgoers 'taken hostage' amid Marawi siege

The ongoing violence has forced thousands to flee Marawi, located about 816km south of the capital, Manila.

"We are sad to see our children like this. They are just sleeping anywhere," Somaira Aloon, an evacuee, told Al Jazeera. "We can't work, it's a difficult life."

The International Committee of the Red Cross described the situation as "very fluid".

"We are seriously concerned about those who are trapped or have chosen to stay in the city, who are in need of food and water.

"This is currently a challenge for our teams on the ground as they assess the situation in order to have a clear picture of the number of displaced people and their needs," said Pascal Porchet, who heads ICRC's efforts in the country.

'Presence of foreign fighters verified'

Al Jazeera's Jamela Alindogan, reporting from Marawi, said: "The Maute has specifically harassed and killed Christians in the area. Since last year, they have been raising ISIL's black flag in government facilities."

She said reports that foreign fighters had joined the group had been circulating since 2012.

"But for years, the Philippine military denied even the existence of Maute and its links with ISIL," our correspondent said. "Although there is very little evidence that Maute is indeed connected to ISIL, the presence of foreign fighters here is verified. They come here and engage in combat training."

President Rodrigo Duterte on Tuesday delivered on his longstanding threat to impose martial law on Mindanao, the country's second-largest island and home to 22 million people - roughly one-third of the population.

A day later, Duterte said he may impose nationwide martial law.

He recently warned that ISIL was determined to establish a presence in the southern Philippines and the country was at risk of "contamination".

Calida said the Maute group and ISIL wanted to create its own "province" in Mindanao and the government was not the only target of their aggression.

"People they consider as infidels, whether Christians or Muslims, are also targets of opportunity," he said.

"What it worrisome is that the ISIS has radicalised a number of Filipino Muslim youth."

His admission elevates the threat of what experts says are moves by ISIL to exploit the poverty and exclusion of the majority Muslim southern Philippines to establish a base for fighters from Southeast Asia and beyond.

Bae a Labi Alsham Cayongcat, a humanitarian worker, told Al Jazeera: "Children in an evacuation centre, or children in remote areas who may have not felt the basic services that can be afforded to them by the government, they can be vulnerable to any indoctrination."

The Maute's rise

The Maute is a fierce, but little-known group that has been a tricky battlefield opponent for the military.

It was blamed for a bombing in Duterte's home city of Davao in September last year, which killed 14 people and wounded dozens.

The Maute's rise is a source of concern for Mindanao native Duterte, who is familiar with Muslim separatist unrest but alarmed by the prospect of rebels helping ISIL to recruit and establish a presence in the volatile region.

Hostilities erupted after security forces raided a Marawi apartment in a bid to capture Isnilon Hapilon, the leader of Abu Sayyaf.

OPINION: Peace is still possible in Duterte's Philippines

The operation went wrong after allied Maute fighters called in reinforcements, and then went on a deadly rampage throughout the city.

The government says Hapilon has been the point man for ISIL in the Philippines and has been collaborating with the Maute leaders.

Calida, the solicitor general, said ISIL had declared that Hapilon was "their emir, or leader in the Philippines".

Richard Heydarian, assistant professor in international affairs and political science at De La Salle University in Manila, told Al Jazeera that until now, Duterte was more focused on his "war on drugs".

"In the past two years, peace negotiations have been in hibernation mode," he said. "Duterte, who is the first Philippine president from Mindanao, strangely has not prioritised peace negotiations because of his almost obsessive focus on the war on drugs which he has been waging for the past 10 months or so."