Tripoli's worst armed clashes in a year have killed 55 people and wounded 146, Libyan media reported Wednesday, as a truce took hold.
Fighting erupted on Monday night and raged through Tuesday between the influential 444 Brigade and the Al-Radaa, or Special Deterrence Force, two of the myriad of militias that have vied for power since the overthrow of longtime dictator Moamer Kadhafi in 2011.
Libya's al-Ahrar TV reported the new toll, citing Malek Mersit, spokesman for the Emergency Medical Centre. Medics had previously reported 27 dead and 106 wounded over the two days of fighting in the capital.
In August last year, 32 people were killed and 159 wounded in Tripoli during battles between divided Libya's two rival administrations that compete for power through shifting alliances with the militias on the ground.
Libya has seen more than a decade of stop-start conflict since the NATO-backed revolt that toppled Kadhafi.
A period of relative stability had led the United Nations to express hope for delayed elections to take place this year, and the latest fighting triggered international calls for calm.
The clashes were triggered by the detention of the head of the 444 Brigade, Colonel Mahmud Hamza, by the rival Al-Radaa Force on Monday, an interior ministry official said.
Late Tuesday, the social council in the southeastern suburb of Soug el-Joumaa, a stronghold of the Al-Radaa force, announced that an agreement had been reached with Prime Minister Abdelhamid Dbeibah, head of the UN-recognised government based in the capital, for Hamza to be handed over to a "neutral party".
In a televised announcement, the council said a ceasefire would follow the transfer of the force's commander, and late on Tuesday the fighting abated.
Both armed groups are aligned with Dbeibah's government.
A total of 234 families were evacuated from frontline areas in the capital's southern suburbs, along with dozens of doctors and paramedics trapped by the fighting while caring for the wounded, the Emergency Medical Centre said.
Overnight Tuesday-Wednesday, Dbeibah visited the southeastern suburb of Ain Zara, which saw some of the heaviest fighting on Tuesday, accompanied by Interior Minister Imed Trabelsi.
Dbeibah "saw for himself the severity of the damage" as he toured the densely populated neighbourhood's unlit streets, his government's press office said on its Facebook page.
He gave instructions for a survey of the damage to be carried out so that residents could be compensated, it added.
The interior ministry put in place a security plan to deploy officers to battleground districts to oversee the truce announced between the two sides.
The Libyan capital's only civilian airport, Mitiga, which lies in an area under Al-Radaa's control, reopened to commercial flights on Wednesday, officials said. Flights had been diverted to Misrata about 180 kilometres (110 miles) to the east.
In May, the two armed groups had clashed for hours in Tripoli, also after the arrest of a 444 Brigade member.
The UN mission in Libya said it was "following with concern" the security deterioration in Tripoli and its impact on civilians.
Human Rights Watch Libya researcher Hanan Saleh expressed outrage that the capital's armed groups continued to settle their differences with heavy weaponry in residential areas without being held accountable.
"Surely, Libyans at risk of such violent incidents deserve more? Nothing will change unless there are consequences," she said.
Libya specialist Jalel Harchaoui said the latest fighting highlighted the failure of the international community to address the problem of the militias.
"However events unfold, the past three years have been wasted by diplomats, politicians, the security planners and peace building specialists. Tripoli is a territory even more dominated by the militias than before," Harchaoui said.
The 444 Brigade is affiliated with Libya's defence ministry and is reputed to be the North African country's most disciplined. It controls the southern suburbs of Tripoli and other areas.
The Al-Radaa force, commanded by Abdel Rauf Karah, is a powerful ultra-conservative militia that acts as the capital's police force and controls central and eastern Tripoli, Mitiga air base, the civilian airport and a prison.
Libya is split between Dbeibah's UN-backed government in the west and another in the east backed by military strongman Khalifa Haftar.