Philippine President Rodrigo Duterte delivers a speech during the 33rd National Convention of the Philippine Coast Guard Auxiliary (PCGA) in Davao City on the southern island of Mindanao, on May 19. (AFP/Getty)

Philippine President Rodrigo Duterte declared martial law Tuesday on the southern island of Mindanao as security forces battled heavily armed militants linked to the Islamic State in a provincial capital.

Duterte issued the declaration in Moscow, where he was on an official visit.

Earlier Tuesday, Philippine forces clashed with militants in Marawi City, the capital of Lanao del Sur Province on Mindanao, during a government attempt to capture Isnilon Hapilon, the leader of an Islamic State branch in Southeast Asia who pledged allegiance to the terrorist group in 2014.

At least two soldiers and one police officer have been killed and a dozen other soldiers wounded in the fighting, Philippine Defense Secretary Delfin Lorenzana said, according to ABS-CBN News.

He described the militants as members of the Maute group, a radical Islamist organization also known as the Islamic State of Lanao. It is said to be made up of former members of a long-standing Muslim separatist group on Mindanao and some foreign fighters.

This photo taken on May 10, 2017 shows Philippine soldiers patrolling along a village near a highway in Maguindanao province, on the southern island of Mindanao, after almost a week of attacks on members of the Bangsamoro Islamic Freedom Fighters. More than 24,000 people fled their homes as the Philippine military used airstrikes and artillery against Muslim extremists who have pledged allegiance to the Islamic State, authorities said May 11. (Ferdinandh Cabrera/AFP/Getty Images)

Mindanao has been the center of a decades-old insurgency by Muslim rebel factions in the predominantly Roman Catholic country.

Lt. Gen. Eduardo Ano, the armed forces chief of staff, said nearly 50 gunmen entered Marawi City, which has a population of about 200,000, and burned houses and other buildings to sow confusion during the fighting, the Associated Press reported.

One group of fighters took up positions near a hospital, where they raised a black Islamic State-style flag, while others battled troops and police near a provincial jail, AP said.

“The whole of Marawi City is blacked out,” Lorenzana said. “There is no light, and there are Maute snipers all around,” so the Philippine troops are holding their positions. He said reinforcements would arrive Wednesday.

Among the buildings torched by the militants were a church, the city jail, a school, a college and a number of homes, Lorenzana told reporters in Moscow, where he was accompanying Duterte. There were also unconfirmed reports that some students were trapped in Marawi’s Mindanao State University complex, near the scene of clashes earlier in the day.

Hapilon, 51, whose hideout in Marawi City was targeted by Philippines troops Tuesday, is on the FBI’s “most wanted terrorist” list, with a $5 million reward for his capture. He is under indictment in the District of Columbia for alleged terrorist acts against Americans and other foreigners in the Philippines, notably the murder of hostages taken by the Abu Sayyaf group while he was its deputy commander.

According to Ano, Hapilon, who was reported wounded in a Philippine airstrike in January, was in Marawi City with more than a dozen of his fighters, who called for reinforcements from the allied Maute group.

Duterte decided to cut short his visit to Moscow, where he had been scheduled to meet Russian President Vladi­mir Putin and Prime Minister Dmitry Medvedev.

“The president feels he is needed in Manila ASAP,” Foreign Secretary Alan Peter Cayetano said.

Presidential spokesman Ernesto Abella said in Moscow that martial law would be in effect on the entire island of Mindanao for 60 days.

The declaration of martial law was necessary “in order to suppress lawless violence and rebellion and for public safety,” Abella told reporters. “The government is in full control of the situation,” he added, but is “fully aware that the Maute/ISIS and similar groups have the capability, though limited, to disturb the peace.”

Lorenzana said martial law measures on Mindanao would include suspension of the writ of habeas corpus, the imposition of curfews and establishment of checkpoints.

The martial law declaration for the entire island of Mindanao, home to an estimated 21 million people, promptly raised questions about whether Duterte’s response was proportionate to the threat or whether other motives were involved.

Since he took office last year, Duterte, a former mayor of Davao City on Mindanao, had raised the prospect of martial law several times, usually in connection with his deadly crackdown on the Philippines’ drug trade. But critics have also accused him of harboring authoritarian tendencies.

Upon returning in March from a trip to Thailand, where a military junta took power in 2014, Duterte told reporters he was considering martial law and the suspension of local elections to deal with the drug threat and other issues. “If I declare martial law, I will finish all the problems, not just drugs,” Duterte said, reiterating a threat to crack down on Islamist militants.

In 1972, then-President Ferdinand Marcos declared martial law to ensure that he would remain in power beyond the end of his second term the following year. He went to rule the Philippines for 14 more years until he was overthrown in the country’s “People Power” uprising in 1986.

A rebellion by Muslim insurgent groups peaked in the 1970s, but fighting with Philippine troops has flared occasionally since then on Mindanao, fueled by militant influences from elsewhere in Southeast Asia and beyond.

The relatively new Maute group, which has pledged allegiance to the Islamic State, was blamed for a bombing that killed 15 people in Davao City in September. Last month, troops captured a Maute jungle camp in Lanao del Sur, recovering arms, explosives, uniforms and passports of suspected Indonesian militants, the AP reported.