TRIPOLI - Libya’s supreme court on Thursday invalidated the internationally recognised parliament, setting the stage for deepening political chaos in the violence-wracked North African nation.

The ruling, which cannot be appealed, prompted celebratory gunfire in the capital Tripoli where Islamist-led militias have been in control since August, an AFP correspondent reported. The Tripoli court also nullified a constitutional amendment that led to elections on June 25, thereby invalidating the polls and all decisions that resulted from them.

The internationally recognised parliament has been sheltering in the remote eastern town of Tobruk along with the government of Prime Minister Abdullah al-Thani for security reasons. Islamist-led militias control most of the country, including Libya’s second city Benghazi in the east which has been rocked by near-daily violence.

The legislature’s legal committee held an emergency meeting to review the court ruling. “Lawmakers will not recognise a verdict decided under the gun,” Tobruk-based parliamentarian Issam al-Jehani wrote on Facebook.

Libyan authorities have struggled to assert control across a country awash with weapons and powerful militias that ousted longtime autocratic leader Moamer Kadhafi in a 2011 revolt.

The supreme court had been asked by an Islamist lawmaker to rule on the constitutionality of the legislature that approved Thani’s government, one of two rival administrations in the oil-flush country.

“The ruling gives legitimacy” to the Islamist-dominated General National Congress, or parliament, which had been ousted by the June 25 elections, said analyst Fraj Najm.

Libya descended into further chaos after the June vote. The GNC, which is backed by the powerful Fajr Libya (Libya Dawn) coalition of Islamist militias, refused to recognise the new parliament dominated by anti-Islamists, held rival sessions in Tripoli and formed its own government.

The power struggle between Islamists and nationalists was reflected by violence across the country.

Islamist lawmakers such as Abderrauf al-Manai boycotted the Tobruk sessions, arguing that the legislature was in breach of the constitution because it was sitting in neither Tripoli nor Benghazi.

Manai petitioned the supreme court for a ruling, insisting that parliament had exceeded its authority in calling for foreign military intervention after the militia takeover of the capital in August.

“I hope all parties will respect the decision of the court,” Manai told television channel Al-Nabaa. GNC vice-president Salah al-Makhzoum said he will respect the ruling and assembly spokesman Omar Hmidan said the Congress is now the country’s “sole legitimate body”.

Former rebels who fought Kadhafi have formed powerful militias and seized control of large parts of turmoil-gripped Libya over the past three years.

The supreme court ruling follows intense clashes between pro-government militias and Islamist fighters in Benghazi that have killed more than 30 people in the past three days, according to medics.

Witnesses have described the fighting, which included heavy shelling, as among the fiercest since former general Khalifa Haftar launched a new government-backed offensive on the eastern city in October.

Islamist militias, including fighters from the radical Ansar al-Sharia group, took near total control of Benghazi in July.

Ansar al-Sharia is blacklisted by Washington as a terrorist group for its alleged role in a deadly 2012 attack on the US consulate in Benghazi.

France, Britain and the United States on Tuesday asked a Security Council committee to add the group to a UN terror list for its ties to Al-Qaeda.