MANILA, Philippines — The Philippine Supreme Court upheld on Tuesday the president’s declaration of martial law in the south in a legal boost to a military offensive that the defense chief said may soon succeed in quelling an uprising by Islamic State group-linked militants.

Supreme Court spokesman Theodore Te said 11 of 15 justices voted to dismiss petitions against the declaration of martial law, which President Rodrigo Duterte imposed across the country’s southern third for 60 days after hundreds of gunmen waving IS-style black flags laid siege to southern Marawi city on May 23.

The petitioners argued the siege did not constitute a rebellion that could justify martial rule which might foster human rights abuses in a country that ousted dictator Ferdinand Marcos in a 1986 revolt for massive rights violations.

“We were hoping the Supreme Court would be our last line of defense against a patently absurd decision built on a failure of intelligence and a rhetoric of violent machismo,” said Machris Cabreros of Akbayan, a left-wing political party whose officers were among the petitioners. “Instead they caved in and unwittingly opened the door to further creeping authoritarianism.”

The government’s top lawyer, Solicitor General Jose Calida, welcomed the decision, saying, “as the conscience of our nation, the Supreme Court did not sit idly to watch our country get dismembered.”

Calida has said evidence showed that an IS-linked alliance of four local extremist groups plotted to seize predominantly Muslim Marawi as part of a plot to create an Islamic caliphate in Southeast Asia. Duterte’s move helped troops capture militants and block their movement, security officials said.

After 43 days of intense ground assaults and airstrikes, troops have recaptured most areas of Marawi including parts of its central business district, where the gunmen turned buildings into sniper posts that slowed the military’s advance for weeks. Troops regained control Monday of a key school compound where they recovered 15 assault weapons and found the remains of a foreign-looking fighter, probably a Singaporean, military officials said.

In a speech marking the air force’s founding anniversary at Clark freeport north of Manila, Duterte said more than 40 Philippine aircraft were involved in the Marawi offensive.

“As we wrap up in our campaign to liberate Marawi, I am confident that the Philippine air force will once again take an active role in the rebuilding of the city,” Duterte said.

In May, Catholic bishops in the southern Philippines supported the declaration of martial law in Mindanao following the extremist attack, although they insisted it must be “temporary.”

Defense Secretary Delfin Lorenzana told reporters that troops may be able to recapture the last few areas held by the militants in a week but he added that if the gunmen “fight to the last, then it will be longer.”

Defense officials hope the crisis will end before Duterte delivers his annual state of the nation address on July 24, but Lorenzana said he would let commanders set the pace of the battle to avoid adding pressure that could endanger troops.

The military says 300 to 500 residents may still be trapped in their homes by fierce street-to-street battles. More than 1,700 civilians have been rescued by troops and government volunteers, including many who were shell-shocked, starving or sick.

About 400,000 villagers have abandoned Marawi, a bastion of Islamic faith with hundreds of mosques, and outlying towns in Lanao del Sur province, about 800 kilometers (500 miles) southeast of Manila.

The unprecedented urban attack has alarmed Southeast Asian and Western governments, which fear that the Islamic State group’s brutal rule in Syria and Iraq, now collapsing, may have galvanized Asian militants into attempting to create their own so-called Islamic caliphate in the region with funds from Middle East-based jihadis.

Despite Duterte’s antagonism toward U.S. and Australian officials, who have criticized his bloody crackdown on illegal drugs, the Western allies have deployed surveillance planes to help Philippine troops track down the remaining militants in Marawi.

Lorenzana said Australia deployed two P3 Orion aircraft Friday in Marawi, where a similar U.S. surveillance plane started operating a few weeks ago.

European officials, also often a target of Duterte’s verbal attacks, announced Tuesday they will provide 49 million pesos ($980,000) in emergency aid for displaced civilians.

Intense daily airstrikes have depleted the military’s stockpile of bombs dropped by a new fleet of South Korean-made FA50 fighter jets, so a Philippine air force cargo plane was dispatched to the United States to pick up new supplies, Lorenzana said.

Meanwhile, Cardinal Luis Antonio Tagle of Manila called on Christians and Muslims in the Philippines to stand together against extremism.

“Whoever planned to divide the Christians and Muslims is probably [angry] now. They were unsuccessful. Instead, [what] we have witnessed is a communion,” Tagle said.

The cardinal told Filipinos to be “attentive” to the “signs of love, hope, and light” amid violence in Mindanao.

“Peace can only be achieved by truth, justice, and love. Without these foundations, there can be no peace,” Tagle said.

Associated Press writer Jim Gomez and Crux staff contributed to this report.