Philippines President Rodrigo Duterte said his martial law declaration for the country's restive south was necessary in order to fight militants there.
"I had to declare martial law in the Mindanao group of islands," Duterte said at a news conference Wednesday. "It is our constitutional duty to enforce the law and provide security."
Duterte's order -- which covers both the city of Marawi and the wider island of Mindanao, of which Marawi is a part -- came after deadly clashes broke out between Filipino government troops and Islamist militants Tuesday.
If the terror threat spreads, Duterte said he's not afraid to go further.
"If I think that the ISIS has already taken foothold also in Luzon and terrorism is not really far behind, I might declare martial law throughout the country to protect the people," said the President, who cut short a visit to Russia to come home to deal with the violence.
Fighting between government forces and the Maute group, an Islamist militant organization based in Mindanao, began in Marawi, a city of about 200,000 people.
ISIS' media wing, Amaq Agency, put out a statement announcing that "fighters of the Islamic State launch a wide-scale offensive on positions of Philippine troops in the city of Marawi."
Presidential spokesman Ernesto Abella confirmed that the fighters had taken over several government buildings in the city, and had torched others, including a church, a school and the city jail. It was not clear from his statement how damaged the buildings were by the arson.
Mindanao is home to a sizable Muslim population, in contrast to the remainder of the country, which is overwhelmingly Catholic.
The militants also reportedly took over a medical center and replaced the Philippines flag with a black, ISIS-style banner.
Armed Forces of the Philippines (AFP) spokesman Lt. Col. Jo-Ar Herrera said that Isnilon Hapilon, the leader of the Abu Sayyaf Group, which has pledged allegiance to ISIS, was among the armed men.
Three government troops died in the fighting, said Abella, and 12 were injured. Martial law was declared about 10 p.m. Tuesday night, and reinforcements were expected.
"Our operation is still ongoing in Marawi City and sporadic fighting is still continuing," a statement from the Armed Forces of the Philippines said.
"The joint AFP-PNP team that is after Isnilon Hapilon and his cohorts is determined to finish him off," the statement said.
Residents were sheltering in their houses overnight, said Abella. Social media users in the city posted photos online that claimed to show residents attempting to evacuate the city Wednesday morning.
Russian weapons to fight Philippines militants
The violence prompted Duterte to cut short a visit to Moscow, during which one of his top priorities was to acquire Russian-made precision armaments to use against the militants in the Southern Philippines. It's highly unusual for a US ally to purchase arms from Russia, an adversary, though Duterte said in October he planned to "break up" with the United States and turn to Russia and China.
Speaking from Moscow, Philippines Foreign Secretary Alan Peter Cayetano said that the violence in Mindanao, one of the Philippines' southernmost islands, was Duterte's priority, despite the high-profile visit to Moscow and St. Petersburg.
"(The Russians) understand that the security of the Filipino people, especially in Marawi and in Mindanao, is a priority," Cayetano said. "I will be staying behind. The agreements will be signed."
Extended martial law
Martial law will be in effect on the Muslim-majority southern Philippines island for 60 days "to suppress lawless violence and rebellion and for public safety," said Abella, according to PNA.
Under the 1987 constitution, the president has the ability to place the country under martial law, though Congress has the ability to revoke the proclamation. The period should not last more than two months
However, Duterte says martial law in the southern Philippines could last a year.
"If it would take a year to do it, then we'll do it. If it's over within a month, then I'd be happy," Duterte said in a video posted on Facebook by Mocha Uson, the assistant secretary to the Presidential Communications Operation Office.
The country suffered 14 years of martial law under former dictator Ferdinand Marcos, who was ousted in a peaceful revolution in 1986.
During those 14 years, perceived opponents of Marcos were subjected to numerous human rights violations, including imprisonment, forced disappearances and torture. Extrajudicial killings carried out by Marcos' secret police were also common.
Many young Filipinos have little or no knowledge of the period under Marcos, and of life under martial law.
Duterte praised the use of martial law by Marcos, calling it "really good" at his news conference.
Authorities have accused the Maute of involvement in a bombing in Duterte's hometown of Davao in September that left 14 people dead.
Terrorism has been a persistent problem in the southern Philippines, where Maute and Abu Sayyaf are based.