The Congress of the Philippines voted to extend martial law on the southern island of Mindanao until the end of the year, giving President Rodrigo Duterte extra time to quell fighters allied with the Islamic State of Iraq and the Levant (ISIL, known as ISIS) group.
In a special joint session of the House and the Senate on Saturday, the overwhelming number of 261 legislators, accounting for more than two-thirds of Congress membership of more than 300, agreed to extend military rule in Mindanao region until December 31.
Just 18 voted against the motion.
In advance of the voting, security officials told members of parliament that martial law was needed to stabilise a region where ISIL fighters were gaining influence, and supporters could be inspired to stage uprisings in areas on Mindanao, joined by foreign fighters.
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.
Fears of 'Philippines-wide martial law'
Opposition dragged out the debate, questioning why martial law was needed for the whole of Mindanao when the fighting was limited to only one city.
"I fear that the plan to extend the martial law in Mindanao will pave the way for a Philippines-wide martial law," Senator Risa Hontiveros told AFP news agency before the vote.
At the hearing, defence and security officials justified the extended martial law, saying that aside from Marawi, fighters were planning attacks in other parts of Mindanao.
They said almost 1,000 pro-ISIL fighters, holding 23 hostages, were still active elsewhere in the south.
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 on 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.
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.
The subject remains sensitive in the Philippines, decades after the late leader Ferdinand Marcos put the country under military rule for part of his 20-year term.
About a dozen protesters in the gallery interrupted Saturday's hearing, chanting "never again, never again to martial law" before being escorted out.
Duterte had already beaten back a Supreme Court petition to declare martial law in Mindanao illegal.
The conflict in Marawi City has left more than 600 people dead, including 105 government soldiers and 428 fighters. Forty-five civilians have been executed by the pro-ISIL forces while 40 displaced residents have died from illness.
More than half a million people have been forced to flee their homes in Marawi City and surrounding towns due to the crisis.
Source: News agencies