The US, UK, France and Italy have called for an immediate end to deadly violence in the Libyan capital Tripoli.

A joint statement said attempts "to weaken the legitimate Libyan authorities and hinder the ongoing political process are not acceptable".

At least 39 people, including civilians, have died in rival militia clashes in Tripoli in recent days.

A UN-backed government is nominally in power in the capital, but militias occupy much of the rest of the country.

"We are calling on the armed groups to immediately stop all military action and warn those who seek to undermine stability, in Tripoli or elsewhere in Libya, that they will be made accountable for it," the joint statement read.

The violence broke out on Monday when militias from a city to the south of Tripoli attacked the city's southern areas, leading to fighting with local militias that support the internationally recognised government, the Government of National Accord (GNA).

The GNA's health ministry said on Friday that at least 39 people had been killed, including a Malian national who was killed by shelling on his home. Dozens of other people are reported to have been wounded.

Human Rights Watch condemned the violence and said that at least 18 of the dead were civilians, among them four children.

Hundreds of migrants trapped by the fighting have been moved to other detention centres, while the city's airport was closed for two days on Friday.

Libya has faced continuing chaos since Nato-backed forces overthrew long-serving ruler Col Muammar Gaddafi in October 2011, with rival political forces in the east and west and powerful armed militias across the country.