The Philippine city of Iligan was overflowing with evacuees and on lockdown on Monday over fears Islamist militants had sneaked out of nearby Marawi, where troops were battling to drive out gunmen holed up in buildings for a seventh day.
The fighting in the city of Marawi with pro-Islamic State militants of the Maute group is the biggest security challenges of Rodrigo Duterte's 11-month presidency, with gunmen still holding parts of the city and fending off helicopter air strikes and ground attacks by commandos.
Most of Marawi's 200,000 people have left, many pouring into Iligan, some 38 km (24 miles) away, where authorities said they were stretched to the limit and worried that Maute fighters were blending in with the displaced and could launch attacks.
"We don't want what's happening in Marawi to spill over in Iligan," said Colonel Alex Aduca, chief of the Fourth Mechanized Infantry Battalion.
"We want to ensure the safety of people here, to prevent elements from entering and conducting terroristic activities," he told DZMM radio.
He said some rebels had been caught trying to get into Iligan, but did not give details.
Sixty-one militants, 20 members of the security forces and 19 civilians have been killed since Tuesday, when Maute rebels went on the rampage in Marawi after a botched attempt by the military to arrest Isnilon Hapilon, who the government believes is a point man for Islamic State in the Philippines.
The ability of the Maute group to fight off the military for so long will add to fears that Islamic State's radical ideology is spreading in the southern Philippines, and it could become a haven for militants from Indonesia, Malaysia and beyond.
The military believes the Maute carried out their assault before the Muslim holy month of Ramadan to capture the attention of Islamic State and earn its recognition as a Southeast Asian affiliate.
Witnesses in Marawi said they had seen militants flying the Islamic State flag and wearing black outfits and headbands typical of the group.
Troops on the streets of Marawi fired at Maute snipers as smoke poured out of several buildings.
Trucks loaded with marines arrived to reinforce soldiers guarding deserted streets as helicopters circulated above the lakeside city surrounded by jungle-clad hills.
The military said the Maute group was still present in nine of the city's 96 Barangays, or communities. Thousands of people were stranded, worried they could be intercepted by militants that have set up checkpoints on routes out of the city.
Civilians stuck in Marawi were without food and were as anxious about rocket strikes as much as they were the militants, said Zia Alonto Adiong, a politician coordinating efforts to evacuate civilians.
He said there were still dead bodies in Marawi and civilians wanted the military to stop air strikes.
"The anticipation of death is worse than death itself," he said in a television interview. "We appeal to our military forces to do a different approach."
Bodies of what appeared to be executed civilians were found in a ravine outside a Marawi on Sunday as the crisis took a more sinister turn. Most of the eight men were shot in the head and some had bound hands.
The army said it was possible more "atrocities" had taken place.
Duterte imposed martial law last week on Mindanao, an island of 22 million people where both Marawi and Iligan are located, to quell the unrest and wipe out militancy.
Some rights activists and lawmakers say martial law across the island is an overreaction that will increase the risk of human rights abuses by security forces.
Presidential spokesman Ernesto Abella said the imposition of martial law was necessary, and constitutional.
"It started flying the flag of the Islamic state of Iraq and Syria in several areas, thereby openly attempting to remove from the allegiance to the Philippine government this part of Mindanao," Abella told reporters.
"This constitutes the crime of rebellion."