Philippine President Rodrigo Duterte cut short a visit to Russia and imposed martial law on the island of Mindanao on Tuesday.
The move came after a fierce bout of fighting erupted during a raid by security forces at a hideout of Daesh-linked militants.
Two soldiers and a policeman were killed and 12 wounded amid chaos in Marawi, a predominantly Muslim city of about 200,000 people, where members of the Maute militant group took control of buildings and set fire to a school, a church and a detention facility.
Duterte, a native of Mindanao, cancelled a meeting set for Wednesday with Russian Prime Minister Dmitry Medvedev.
Tass news agency said President Vladimir Putin would see him before his departure Tuesday night, instead of on Thursday as planned.
"The government is in full control of the situation and is fully aware that the Maute/ISIS [Daesh] and similar groups have the capability, though limited, to disturb the peace," presidential spokesman Ernesto Abella told a news conference in Moscow.
The Maute and Abu Sayyaf militant groups have pledged allegiance to Daesh and have proved fierce opponents for the military.
Abella said the militants "have shown no hesitation in causing havoc, taking innocent lives and destroying property."
Duterte has warned repeatedly that Mindanao, an impoverished, restive region the size of South Korea, was at risk of "contamination" by Daesh driven out of Iraq and Syria.
Brigadier General Rolando Bautista, commander of the Philippines' First Infantry Division, said security forces were trying to locate militants who had scattered everywhere and were blocking reinforcements from arriving.
"There are more or less 100, divided into groups of 10 in different locations," Bautista told news channel ANC.
Civilians told to stay indoors
Defence Secretary Delfin Lorenzana said some 1,000 soldiers would be in Marawi by morning, but warned civilians to stay in their homes.
"There are Maute snipers all around, so the troops are still holding and elements have already joined," he said.
The purpose of Tuesday's raid was to capture Isnilon Hapilon, a leader of the Abu Sayyaf group which is notorious for piracy and for kidnapping and beheading Westerners.
The US State Department has offered a bounty of up to $5 million for Hapilon's arrest.
The military has not explained how the raid on an apartment turned into urban warfare that was still raging 12 hours later.
The incident highlights the challenges facing Duterte, who has pleaded with separatists and moderate Muslims in the predominantly Catholic nation to shun Abu Sayyaf and Maute.
He has threatened several times to declare martial law in Mindanano, and deliver a "harsh" crackdown. Martial law will apply for 60 days.
The government has blamed the Maute for a bombing in September 2016 at a street market in Duterte's hometown of Davao City, which killed 14 people and wounded dozens.
Maute fighters took over a disused building in the region in November and endured five days of military air and ground assaults before fleeing, with 61 fighters killed.