Two powerful militias that back Libya’s UN-supported government have clashed in the capital, Tripoli, killing 55 people and injuring 146 others, medics say.
The fierce fighting, which erupted on Monday until late on Tuesday, forced the city’s main airport to close.
It only subsided after one side released a commander whose detention had triggered the fighting.
Libya remains in political chaos after long-serving ruler Col Muammar Gaddafi was overthrown and killed in 2011.
The country is effectively now split between an interim, internationally recognised government in the Tripoli and another one in the east.
A 2020 ceasefire has brought a measure of peace, but entrenched factionalism on all sides constantly threatens to upset it.
Fighting has left many people trapped in their homes as battles took place in several districts of the capital, including Ain Zara in the south-east.
The latest violence was between brigades that operate in Tripoli, where Prime Minster Abdul Hamid Mohammed Dbeibah heads a government.
The Special Deterrence Force, which controls the airport, arrested a senior commander from the 444 Brigade as he tried to travel on Monday.
The commander had once been an officer in the rival militia, the Reuters news agency reports.
According to Libya’s Emergency Medicine and Support Center, 234 families had to be evacuated from frontline areas with 60 ambulances deployed and three field hospitals set up to deal with the causalities.
The prime minister intervened and managed to get the commander released to a “neutral party”, the AFP news agency reports.
He later toured the neighbourhoods affected to see the scale of the damage.
The airport reopened later on Wednesday, AFP says.
The UN mission said it was concerned about the possible impact of these developments on the ongoing efforts to prepare for elections, which were delayed two years ago.
“All parties must preserve the security gains achieved in recent years and address differences through dialogue,” its statement said.