Tripoli (AFP) - Forces loyal to Libya's unity government said Saturday that 52 of its fighters were killed as they repelled rival militias in fierce clashes in the capital Tripoli.

Apart from sporadic gunfire in southern Tripoli, calm returned to the city on Saturday, the first day of the Muslim holy month of Ramadan.

Among the 52 killed in Friday's clashes which centred on the southern district of Abu Slim, said Hashem Bichr, a security official of the Government of National Accord, were 17 members of pro-GNA forces who had been "executed".

There was no immediate confirmation from medical or other independent sources of the death toll, updated from Friday's health ministry figures of 28 dead and more than 100 wounded that did not give a breakdown of the casualties.

UN special envoy Martin Kobler condemned the fighting in which heavy artillery and tanks were used, urging restraint from all sides.

Forces of the UN-backed GNA announced on their Facebook page they had defeated rival militias and taken control of a prison holding key leaders of the ousted regime of Moamer Kadhafi including his last premier, Baghdadi al-Mahmudi, and former intelligence chief Abdullah Senussi.

Al-Hadhba jail had been under the control of the Fajr Libya militia coalition, which had seized Tripoli in 2014 and set up a government headed by Khalifa Ghweil.

The Libyan capital has been gripped by a power struggle ever since a NATO-backed uprising toppled longtime dictator Kadhafi in 2011.

The latest fighting started around a complex of luxury villas that until March served as headquarters of militias loyal to Ghweil, who was ousted when the GNA took office last year but refuses to recognise the new administration.

Loyalist forces seized the villas in four days of intense fighting in March that saw them expand their control over the capital.

Tripoli had been relatively calm since, but dozens of armed groups still operate and several parts of Tripoli remain beyond its control.

Story continues

Relying on militia support and pitted against a rival administration in eastern Libya, the GNA has struggled to assert its authority across the country.

In a statement on Friday, the GNA blamed Ghweil and Salah Badi, another leader of Fajr Libya, for Friday's violence.

"This is their gift to the people for the month of Ramadan," it said in a statement.

Mattia Toaldo, senior policy fellow at the European Council on Foreign Relations, said the main figure to benefit from the Tripoli clashes was military strongman Khalifa Haftar, who supports the eastern administration.

"The man standing to gain from these clashes is again Khalifa Haftar who benefits from the increasing sense of chaos in the capital," he told AFP.