Fighting broke out between rival groups shortly after Fathi Bashagha – appointed as prime minister by the rival government – entered the capital Tripoli.
Libya's rival prime minister Fathi Bashagha has left the capital Tripoli, hours after his attempt to enter the city triggered clashes.
The rival government appointed by Libya's eastern-based parliament entered Tripoli overnight but withdrew hours later on Tuesday as fighting rocked the capital, Bashagha's office said.
The sound of heavy weapons and automatic gunfire crashed across the capital on Tuesday morning, as schools were cancelled and the normally heavy rush hour traffic was sparse.
However, in central areas, away from the clashes on the northeast side of Tripoli, there was little evidence of military activity.
There were no immediate reports of casualties from the fighting.
Bashagha had entered Tripoli overnight accompanied by allied militias in the hope of taking over government but was quickly met by opposition from forces aligned with Abdulhamid Dbeibah, who was appointed through a UN-backed process last year.
Dbeibah has said repeatedly that he will only cede power to an elected government.
The fighting raised fears of a return to the chaos that has reigned since a NATO-backed popular revolt in 2011 toppled Muammar Gaddafi, and an all-out conflict that gripped the capital in 2019-20.
Dbeibah's government was tasked with leading Libya to elections scheduled for last December, but these were indefinitely postponed.
In February, the parliament in Tobruk designated former interior minister Bashagha as prime minister.
In March, pro-Bashagha militias had already deployed on the edges of the capital, raising fears of a confrontation that would end a fragile ceasefire in place since October 2020.
Bashagha is backed by Khalifa Haftar, the eastern-based warlord who led a failed bid to seize Tripoli in 2019-20, and who maintains control of several key oil installations.
The rise of Bashagha's government gives the North African country two rival administrations, as was the case between 2014 and a 2020 ceasefire.