Updated

Philippine President Rodrigo Duterte warned Wednesday that he'll be harsh in enforcing martial law in his country's south as he abruptly left Moscow to deal with a crisis at home sparked by a Muslim extremist siege on a city, where militants burned buildings overnight and are feared to have taken hostages.

Duterte declared martial rule for 60 days in the entire southern Mindanao region, the restive third of the Philippine archipelago, Tuesday evening to try to crush Muslim extremists who have aligned themselves with the Islamic State group (ISIS) and occupied a hospital, jail and other buildings and battled troops in an audacious attack in Marawi City.

Martial law could be extended for a year depending on how long the problem could be quelled, Duterte said on board a plane en route to the Philippines.

"I said I would be harsh and I warned everybody not to force my hand into it," Duterte said. "I have to do it to preserve the republic."

Defense Secretary Delfin Lorenzana said troops raided the hideout of a top terrorist suspect in Marawi on Tuesday, sparking a gunbattle that prompted the militants to call for reinforcements from an allied group, the Maute. He said dozens of gunmen occupied city hall, a hospital and a jail and burned a Catholic church, a college and some houses in a bold attack that killed at least two soldiers and a police officer and wounded 12 others.

Several militants were killed in the fighting in Marawi city in Lanao del Sur province, about 520 miles south of Manila, but others continued to lay siege to the largely Muslim city of more than 200,000 people, officials said, adding that power was cut in the city in the chaos.

"The whole of Marawi city is blacked out, there is no light, and there are Maute snipers all around," Lorenzana said in the news conference in Moscow, which was broadcast live in the Philippines.

Foreign Secretary Alan Peter Cayetano said he informed his Russian counterpart, Sergey Lavrov, of Duterte's decision to fly home early to deal with the crisis. Cayetano said he would stay behind in Moscow, where a number of agreements are to be signed between the governments.

Duterte met late Tuesday with Russian President Vladimir Putin and said he is counting on Russia to supply weapons for the Philippines to fight terrorism.

"Of course, our country needs modern weapons, we had orders in the United States, but now the situation there is not very smooth and in order to fight the Islamic State, with their units and factions, we need modern weapons," he said, according to Russian state news agency Tass.

Duterte's martial law declaration will help government forces carry out searches and arrests and detain rebel suspects more quickly, Lorenzana said. He said offensives would also be staged in other southern provinces plagued by extremist groups. Despite the extremists' moves, Lorenzana said the government remains in control of the situation in Marawi city and other security trouble spots in the south.

Military chief of staff Gen. Eduardo Ano said the fighting started when troops attacked a hideout for Muslim extremist leader Isnilon Hapilon.

Hapilon reportedly has been chosen to lead an ISIS branch in Southeast Asia and is on the U.S. Department of Justice list of most-wanted terrorists worldwide, with a reward of up to $5 million for his capture. An Arabic-speaking Islamic preacher known for his expertise in commando assaults, he pledged allegiance to the ISIS group in 2014, according to security officials.

Ano said Hapilon, who was wounded by a military airstrike in January, and more than a dozen of his men summoned reinforcements from their Maute allies. Nearly 50 gunmen in all managed to enter the city, Ano said.

About 20 of the gunmen took position in a hospital, where they raised a black ISIS-style flag at the gate, and 10 other militants were fighting troops and police near a provincial jail, he said.

Troops sealed off major entry and exit points to prevent Hapilon from escaping, Ano told The Associated Press by telephone from Moscow, where he was accompanying Duterte.

"They did some burnings, they showed up in another area so it looked chaotic, but it's actually a small group facing an overwhelming number of government forces," Ano said.

"We will conduct house-to-house clearing and do everything to remove the threat there. We can do that easily," Ano said, but added it was more difficult in an urban setting because of the need to avoid civilian casualties.

The Maute group is one of less than a dozen new armed Muslim groups that have pledged allegiance to ISIS and formed a loose alliance in the southern Philippines in recent years. Hapilon was reportedly designated the leader of the alliance.

The Maute has been blamed for a bomb attack that killed 15 people in southern Davao city, Duterte's hometown, last September and a number of attacks on government forces in Lanao, although it has faced setbacks from a series of military offensives.

Last month, troops backed by airstrikes killed dozens of Maute militants and captured their jungle camp near Lanao del Sur's Piagapo town. Troops found homemade bombs, grenades, combat uniforms and passports of suspected Indonesian militants in the camp, the military said.

While pursuing peace talks with two large Muslim rebel groups in the south of the predominantly Roman Catholic nation, Duterte has ordered the military to destroy smaller extremist groups which have tried to align with ISIS.

Duterte had repeatedly threatened to place the south, the scene of decades-long Muslim uprisings, under martial law if extremist violence spiraled out of control. Human rights groups have expressed fears that martial law powers could further embolden Duterte, whom they have accused of allowing extrajudicial killings of thousands of drug suspects in a crackdown on illegal drugs.