At least 39 have been killed and nearly 100 others wounded in ongoing battles between rival militias in Libyan capital.

Libya’s UN-backed government has announced a state of emergency in the capital, Tripoli, and its outskirts after several days of fierce fighting between rival armed groups.

At least 39 people, including civilians, have been killed in the violence and nearly 100 others wounded.

“Due to the danger of the current situation and for the sake of the public interest, the presidential council declares a state of emergency … to protect and secure civilians, public and private possessions and vital institutions,” the Government of National Accord (GNA) said in a statement on Sunday.

Reporting from Tripoli, Al Jazeera’s Mahmoud Abdelwahed said stray rockets were responsible for the death of several civilians.

“Since the beginning of the clashes that broke out a week ago, many civilians have been killed as a result of random rockets falling onto densely populated areas,” he said.

“Many people here are blaming the Government of National Accord for not doing enough to stop the conflict.”

Fighting in Tripoli

Libya slid into chaos after the 2011 uprising that overthrew and killed longtime ruler Muammar Gaddafi.

The country is currently governed by two rival authorities backed by an array of powerful armed groups: the Tripoli-based GNA, which is recognised by the UN as Libya’s official government; and the Tobruk-based House of Representatives in the east of the country, which has the support of renegade General Khalifa Haftar.

The fighting in the capital erupted last week when armed groups from Tripoli clashed with others from a town to the south, vying for power in the administration based in the country’s west.

Street battles on Monday and Tuesday pitted the Seventh Brigade, or Kaniyat, from Tarhouna, a town 65km southeast of Tripoli, against the Tripoli Revolutionaries’ Brigades and the Nawasi, two of the capital’s largest factions.

The Kaniyat and other groups from outside Tripoli have noticed the success of rivals inside the city with growing unease. Reports about the wealth, power and extravagant lifestyles of some Tripoli rebel commanders have fuelled resentment.

Broken ceasefire

A fragile truce reached in coordination with the UN mission in Libya took effect on Thursday, but was quickly breached.

In its statement, the Tripoli-based government called the rival militias to stop the fighting and respect the ceasefire agreement, echoing a call issued by Antonio Guterres, the UN secretary-general, a day earlier.

“The Secretary-General condemns the continued escalation of violence in and around Libya’s capital and, in particular, the use by armed groups of indiscriminate shelling leading to the death and injury of civilians, including children,” a statement from Guterres’ office said on Saturday.

“The Secretary-General calls on all parties to immediately cease hostilities and abide by the ceasefire agreement brokered by the United Nations and the Reconciliation Committees.”

Also on Saturday, Britain, France, Italy and the United States said in a joint statement that an escalation would hamper the political process in Libya and plans to hold nationwide elections by December.

The four countries said they “warn those who tamper with security in Tripoli or elsewhere in Libya that they will be held accountable for any such actions”.