Flights resumed and shops re-opened in Libya's capital Tripoli on Sunday after clashes between backers of rival governments killed at least 32 people and sparked fears of major new conflict.
Armed groups had exchanged fire that damaged several hospitals and set buildings on fire starting Friday evening, the worst fighting in the Libyan capital since a landmark 2020 ceasefire.
A cautious calm had set in by Saturday evening, an AFP correspondent reported, and the health ministry said Sunday morning that 32 people had been killed and 159 wounded during the clashes.
The fighting came after months of mounting tensions between backers of Abdulhamid Dbeibah and Fathi Bashagha, whose rival administrations are vying for control of the North African country which has seen more than a decade of violence since a 2011 uprising.
Dbeibah's administration, installed in the capital as part of a United Nations-led peace process last year, has so far prevented Bashagha from taking office there, arguing that the next administration should be the product of elections.
Bashagha was appointed by Libya's eastern-based parliament earlier this year and is backed by powerful eastern military chief Khalifa Haftar, whose 2019 attempt to seize the capital by force turned into a year-long civil war.
Bashagha, a former interior minister, had initially ruled out the use of violence to take power in Tripoli but subsequently hinted that he could resort to force.
Libya plunged into chaos following the 2011 overthrow and killing of dictator Moamer Kadhafi in a NATO-backed uprising, with myriad armed groups and foreign powers moving to fill the power vacuum.
Certain armed groups seen as neutral in the latest crisis moved to back Dbeibah this weekend to push back Bashagha's second attempt to enter the capital.
Both sides exchanged blame on Saturday while world powers appealed for calm.
The UN's Libya mission called for "an immediate cessation of hostilities", deploring "indiscriminate medium and heavy shelling in civilian-populated neighbourhoods".
On Saturday evening, Dbeibah posted a video of himself surrounded by bodyguards and greeting fighters supporting his administration.
Wearing a blue shirt and accompanied by his personal guard, he shook hands and took selfies with supporters.
"We won't leave this country to the scoundrels," he said in the video posted on his Twitter account under the title "end of the aggression".
He said on Sunday he would create two committees to survey the damage from the fighting.
Dbeibah's Government of National Unity said fighting had broken out after negotiations to avoid bloodshed in the western city collapsed.
Bashagha denied such talks had taken place, and accused Dbeibah's "illegitimate" administration of "clinging to power".
Local media reported late Saturday that a group of pro-Bashagha militias that had been making their way to the capital from Misrata later turned back.
The fighting prompted several airlines to cancel flights in and out of the only working airport in the capital, and high school examinations set for the end of August were postponed.
But flights resumed and shops reopened on Sunday morning, while the University of Tripoli announced that exams set for Monday would go ahead as originally planned, annulling an earlier postponement.
On Saturday evening Dbeibah ordered the arrest of anyone involved in the "attack on Tripoli", both civilian and military.
A pro-GNU force from Misrata -- the hometown of both Dbeibah and Bashagha -- said Sunday it had arrested several involved in the attack.
But analysts said the crisis was far from resolved, with the capital controlled by a multitude of armed groups with shifting alliances described by analyst Wolfram Lacher as "a never-ending story".
"The armed groups that found themselves on the same side in yesterday's Tripoli fighting will tomorrow clash over turf, positions and budgets," he wrote on Twitter.
"The factions that were pro-Dbeibah yesterday will challenge him tomorrow."