Media playback is unsupported on your device Media caption Residents passing through checkpoints as they leave

President Rodrigo Duterte has said martial law on Mindanao island could be extended across the Philippines, while the army fights Islamist militants.

Mr Duterte said insurgents had beheaded a policeman on the southern island. At least three other members of the security forces are reported dead.

On Tuesday he imposed martial law on Mindanao, where Muslim separatists and other rebels are fighting the army.

Some of the groups have pledged support for so-called Islamic State (IS).

Thousands of people have been fleeing fighting in the city of Marawi after gunmen rampaged through the city.

Image copyright Reuters Image caption Security forces have been patrolling streets on Mindanao after the declaration of martial law

"I will not hesitate to do anything and everything to protect and preserve the Filipino nation," the president said. "I might declare martial law throughout the country to protect the people."

President Duterte said the police chief of Malabang on Mindanao had been stopped on his way home "at a checkpoint manned by terrorists and I think they decapitated them right there and then".

As he imposed 60 days of martial law on the island on Tuesday, he warned he would be harsh in dealing with terrorism.

"If it takes a year to do it, then we'll do it. If it's over within a month, then I would be happy," he said in a video posted online by the government.

Image copyright AFP Image caption President Duterte's talks with his Russian counterpart Vladimir Putin had to be brought forward

Mr Duterte cut short his visit to Russia to deal with the violence.

During his talks in Moscow with Russian President Vladimir Putin, he also said the Philippines needed more modern weapons to fight IS militants and other militant groups.

Martial law allows the use of the military to enforce order and the detention of people without charge for long periods.

The Philippine constitution says a president can only declare martial law for 60 days to stop an invasion or a rebellion.

Who are the Maute group? - BBC Monitoring

Also known as IS Ranao, the group is based in Mindanao's Lanao del Sur province

Formed in 2012 by Abdullah Maute (aka Abu Hasan) and his brother Omar

Ranks are believed to comprise a few hundred fighters, mostly from other armed Islamist groups

The group's first known encounter with the military came in 2013, when it attacked a security checkpoint in Mindanao

Pledged allegiance to IS in 2015

In February 2016, troops overran the group's Butig headquarters, killing around 40 rebels

The group has also been linked with Isnilon Hapilon, a prominent figure in the Abu Sayyaf militant group

Parliament can revoke the measure within 48 hours while the Supreme Court can review its legality.

This is only the second time martial law has been declared since the fall in 1986 of President Ferdinand Marcos.

Deep-rooted conflict

The violence in Marawi, a city of about 200,000 people in Mindanao, erupted on Tuesday as the army searched for the leader of a militant group that had pledged allegiance to IS, the military said.

Defence Secretary Delfin Lorenzana identified the militants as members of the Maute group. They had occupied a hospital and a jail, and burnt down buildings including a church, he added.

Marawi is about 800km (500 miles) south of the capital Manila.

Mr Duterte had promised that finding a lasting peace on the island would be a top priority for his administration.

But the conflict is complex and deep-rooted, the BBC's Jonathan Head reports.

Solutions have eluded previous governments, and it is not clear that President Duterte's reliance on martial law will prove any more successful, our correspondent says.