The Philippine Congress has voted overwhelmingly to extend martial law in the south until the end of the year.
The legislators backed President Rodrigo Duterte's call for an extension in the Mindanao region to deal with Islamist gunmen who have occupied parts of a southern city for two months.
Duterte had previously imposed a 60-day martial law over Mindanao when fighting broke out in Marawi on May 23, but it was set to expire Saturday.
The Philippine Congress opened a special session Saturday to vote on President Rodrigo Duterte's bid for an extension of martial law in the south to defeat Islamist gunmen.
A slide presentation accompanying Duterte's request, seen by AFP, compared the Marawi crisis to the Islamic State takeover of the Iraqi city of Mosul.
Marawi itself could now become a magnet for foreign fighters in Iraq and Syria, it said.
Most of the militants' leaders remain at large, the presentation added, while about 90 of the gunmen have slipped past security cordons and can link up with other armed groups in the region to mount similar widescale attacks.
At the hearing, defence and security officials justified the need for martial law, saying that aside from Marawi, Islamist militants were planning attacks in other parts of the southern Philippines.
They said almost a thousand pro-IS militants, holding 23 hostages, were still active elsewhere in the south.
In Marawi, the military said only about 60 gunmen were left in a 49-hectare (121-acre) area of Marawi, but Duterte said he needed martial law powers to rebuild the city and ensure the war did not spread elsewhere.
"I cannot afford to be complacent," Duterte told reporters Friday, adding the military would be conducting further "mopping up operations" even after they recapture Marawi.
"If there is a spillage it will not be as bad if you have this stopgap," he added.
Duterte imposed 60-day martial rule -- the maximum period allowed by the constitution -- over the Mindanao region on May 23 within hours of the gunmen beginning their rampage.
On Monday he asked Congress to extend it until the end of the year, along with the continued suspension of a constitutional safeguard against warrantless arrests.
In an unprecedented move, both the House and the Senate met jointly on a weekend to vote on Duterte's request.
'Nationwide martial law'
Martial law allows the military to establish control with measures such as curfews, checkpoints and gun controls in a country where civilians are authorised to keep licensed firearms in their homes.
However, any martial law extension must be approved by Congress.
The subject remains sensitive in the Philippines, decades after the late dictator Ferdinand Marcos put the country under military rule for part of his 20-year term.
Thousands of critics, political opponents as well as communist guerrillas were killed, detained or arrested during the period, according to historians.
About a dozen protesters in the gallery interrupted Saturday's hearing, chanting "never again, never again to martial law" before being escorted out.
House Speaker Pantaleon Alvarez has said previously he sees no roadblock to the swift approval of the extension by both chambers of Congress.
Duterte had already beaten back a Supreme Court petition to declare martial law in Mindanao illegal.
But opposition politicians have criticised Duterte's proposal for an extension, with some alleging it is part of a Duterte plot to eventually bring the country under a military-backed dictatorship.
"Once he feels that there is not enough opposition to a nationwide martial law declaration, he will go for it," Senator Antonio Trillanes told AFP on Tuesday.
After this he could declare a revolutionary government to allow him to stay in office beyond his six-year electoral term in mid-2022, Trillanes says.
Duterte, 72, insists he has no plan to stay in office beyond his term.