Tripoli's worst armed clashes in a year have killed 55 people and wounded 146, Libyan media reported, after a truce took hold in the capital and air traffic was restored.
Libya's Al Ahrar TV updated on Wednesday the death toll to 55, citing Malek Mersit, spokesperson for the Emergency Medical Centre which handles emergency response in the country's west.
Libya has seen more than a decade of stop-start conflict since the NATO-backed revolt that toppled long-time leader Muammar Gaddafi.
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 with rocket launchers and machine-guns followed the detention of the 444 Brigade head, Colonel Mahmud Hamza, by the rival Al Radaa Force on Monday, an interior ministry official said.
Trapped by the fighting
Late on Tuesday, the social council in the southeastern suburb of Soug el Joumaa, a stronghold of Al Radaa, announced that an agreement had been reached with Prime Minister Abdulhamid Dbeibah, head of the UN-recognised government in Tripoli, 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, 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 same armed groups had clashed for hours in Tripoli, also after the arrest of a 444 Brigade member, but only minor injuries resulted.
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 saw the latest fighting as a struggle over territory.
He said it highlighted the failure of the international community to address the problem of the militias and shows that "the past three years have been wasted" by diplomats, peace-building specialists, and others.
"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 armed group. It controls the southern suburbs of Tripoli and other areas.
The Al Radaa force is also a powerful 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 warlord Khalifa Haftar.