MANILA — President Rodrigo Duterte warned on Wednesday that he may declare martial law throughout the Philippines to deal with the threat of Islamist militancy, making the remarks one day after he imposed military rule on a southern island.

Mr. Duterte’s statement came after he cut short a trip to Russia on Tuesday night and announced he was placing the entire southern island of Mindanao under military control because of the growing insurgent threat there. The declaration came after Abu Sayyaf extremists backed by members of another insurgent group burned down buildings in the predominantly Muslim city of Marawi to prevent troops from arresting a top rebel commander.

On Wednesday, he raised the prospect that Islamic State-inspired rebels could gain a foothold in the north of the country. “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,” he said, referring to the country’s largest and most populous island.

“It is our constitutional duty to ensure that every family, every community, all Filipinos, are assured to live in peace and harmony,” he said, while pledging to the public that “there will be no abuses.”