Casting himself as his nation’s savior, President Rodrigo Duterte said Wednesday that he was prepared to extend martial law to all of the Philippines if necessary. “I will not allow the country to go to the dogs,” he said.

Since winning the presidency a year ago, the words “martial law” have rarely been far from Duterte’s lips. On Tuesday, as fighting broke out between the army and Islamist insurgents, he cut short a trip to Moscow and fulfilled his own prediction, declaring martial law across a vast swath of the southern Philippines. At least 21 people have been reported killed in the fighting.

On Wednesday, as insurgents rampaged through the city of Marawi, reportedly taking a Catholic priest and worshipers hostage and torching buildings, Duterte told Filipinos the law would be as “harsh” as it was under Ferdinand Marcos, the country’s longtime dictator whose martial-law-era abuses still loom large.

“I will not allow abuses. The courts will stay open. But to anyone holding a gun or confronting the government with violence, my orders are, ‘Spare no one,’ ” Duterte said in an afternoon news conference. Regarding the Islamic State, he added, “Do not f--- with me. . . . I would not hesitate to do anything and everything.”

Some Philippine militants have declared loyalty to the Islamic State, but there have been no signs so far of close links or material support in this case.

Philippine troops arrive at their barracks to reinforce fellow troops after the siege by Islamist militants in the outskirts of Marawi in the southern Philippines. (AP)

Although the government has yet to specify what, exactly, comes next, the declaration of martial law across the southern island of Mindanao looks set to reshape Duterte’s domestic agenda, broadening his focus from drugs to terrorism and renewing questions about his nostalgia for the Philippines’ authoritarian past.

Martial law could complicate an uncertain moment in U.S.-Philippine ties.

On Tuesday, The Washington Post reported new details of an April 29 call between President Trump and Duterte — details that suggest Trump is willing to work with, and even praise, Duterte despite the Philippine president’s past threats to ditch the United States as an ally.

Relations between the United States and the Philippines were strained under the Obama administration, which criticized Duterte’s tactics on reports of extrajudicial violence in his effort to root out drug dealers. After cursing President Barack Obama and vowing to align himself with China and Russia, Duterte threatened in the fall to expel U.S. Special Forces from Mindanao.

But with terrorism his new expressed target, Duterte may be more willing to work with the United States, experts said, potentially changing the dynamic among Washington, Manila and Beijing.

Though details are still spotty, official and local reports suggest the fighting that triggered the declaration of martial law on Tuesday continued through Wednesday.

Filipinos stage a demonstration against Duterte’s declaration of martial law in Davao, Mindanao Island, in the southern Philippines. (Cerilo Ebrano/European Pressphoto Agency)

The clashes reportedly broke out when Philippine security personnel mounted an operation against Isnilon Hapilon, the Islamic State-endorsing leader of a militant group called Abu Sayyaf. Hapilon and his men sought backup from another Islamic State-aligned force known as the Maute group.

As of Wednesday night, these groups controlled parts of the city, having reportedly taken 14 hostages, including the Catholic priest. In his news conference, Duterte claimed a police officer was beheaded, but that has not been confirmed by local reports.

Ayeesha Dicali, a student from Marawi who was out of the area on Tuesday and Wednesday, said she had received text messages from family members who said they were trapped inside their home because of gunfights. 

Dicali said she was scared — both of the insurgents and the prospect of martial law. “Here, the words ‘martial law’ have really negative connotations, and they remind me of what my mother told me about her life in the Marcos era,” she said.

“At the same time, we’re ambivalent, because maybe this new martial law will mean the soldiers will really respond to the crisis.”

Sidney Jones, an expert on terrorism who serves as director of the Institute for Policy Analysis of Conflict in Jakarta, Indonesia, noted that the U.S. government is offering up to $5 million for the capture of Hapilon.

“Even as Duterte was talking his anti-U.S. and pro-China shift, it was clear that the basic U.S.-Philippine relationship on counterterrorism wasn’t affected, and information and close cooperation continued,” she said.

Duterte is the first Philippine president from Mindanao, and he pitched himself as uniquely equipped to negotiate with insurgents to end long-standing conflicts once and for all.

That hasn’t happened. Since taking power, Duterte has focused on mounting — and defending — a self-proclaimed “war” on drugs, which has been linked to thousands of extrajudicial killings, rather than striking peace deals. He is now under pressure to produce results.

On Sunday, two days before the clashes in Marawi, he predicted that martial law may come to Mindanao. “I already warned you. Please don’t force my hand to kill you,” he said. He is now pitching marital law as the only way to get results.

When Marcos declared martial law in 1972, ushering in more than a decade of violent dictatorship, the United States was fighting the Cold War, not terrorism. Marcos repeatedly used the alleged threat of communist takeover to shore up support in Washington, even as he committed widespread human rights abuses and, with his wife, Imelda, made off with much of the country’s wealth.

President Ronald Reagan, a friend of the couple, backed the Marcos government until just before a “people power” revolution ousted him in 1986.

As president, Duterte has taken a nostalgic view of the Marcos era, even giving the long-dead dictator a hero’s burial in Manila.

Martial law must be approved in the Philippine Congress, where Duterte enjoys wide support. The current constitution places limits on what he could do if it is approved. Still, many warned of possible ­abuses.

Jose L. Cuisia Jr., who served for five years as Philippine ambassador to the United States until June, said the declaration showed a president “obsessed about having full control of all branches­ of government: executive, legislative and judiciary.”

“The lawlessness of President Duterte’s ‘war on drugs’ heightens grave concerns that his declaration of martial law in Mindanao will bring further rampant ­abuses,” Phil Robertson, deputy Asia director at Human Rights Watch, said in a statement. “We urge the Philippine government to ensure that the rights of all Filipinos are respected as it addresses violence and crime in the southern Philippines.”

In the city of Cagayan de Oro, not far from the violence, Aida Ibraham, a leader of a local Muslim organization, held a candlelight vigil,

“We are protesting the acts of violence committed by the attackers,” she said. “But we also oppose the military action and the declaration of martial law.

“With this kind of escalation, it’s always the innocent that pay.”

Rauhala reported from Beijing.