A sudden shootout between factions in the Libyan capital this month provided a vivid demonstration of how a political stalemate could trigger fighting between rival groups and end two years of comparative peace.
Much of Libya has for years been dominated by armed forces that control territory and vie for position while formally acting as paid elements of state security, their presence strikingly apparent during a recent Reuters visit.
In Tripoli, tensions over the standoff between the unity government installed last year and a rival one endorsed by the eastern-based parliament have added to earlier friction in the capital over such groups' relative standing.
Though all sides have publicly said they reject any return to major war and do not expect one, efforts to resolve the standoff have faltered and there are new signs of armed escalation.
Footage shared on social media this week showed a faction opposed to the government in Tripoli moving towards the city from its base in the mountain town of Zintan with a large convoy of military vehicles.
Any prolonged clashes among the different factions in Tripoli could spill over into a wider conflict drawing in forces from across Libya in a new phase of civil war that would hit civilians hardest.
When the shooting began this month at Souk al-Thulatha park near Tripoli's historic centre, families were enjoying the cool sea breeze as a weekend night brought relief from a hot summer day.
Nawal Salem, 42, had gone there with her daughters because a power cut meant she could not run air conditioning at home. The girls played on their bikes and she was scrolling through her phone when she heard the shooting.
In the chaos, as she grabbed her children and ran for home, people were screaming and falling over and she saw lost children, separated from their parents.
"All I remember is carrying my daughters in my arms all the time until we got to a relative's house and I was crying a lot and my daughters were very scared," she said.
STANDOFF
Four people were reported injured, but in a sign of how transitory - and even normal - such flashpoints have become for city residents, the park was busy again the following morning with families strolling and buying ice creams from a van.
However, there are growing signs that wider clashes could happen, putting the 2020 ceasefire between the main sides in the civil war at risk.
The ceasefire was accompanied by a political process that has mostly broken down. An interim unity government under Abdulhamid al-Dbeibah was supposed to hold elections in December but a dispute over the rules stopped the vote.
The parliament and eastern forces in the last war have instead appointed a new government under Fathi Bashagha, but Dbeibah has refused to step down and Bashagha cannot enter Tripoli.
Dbeibah still appears to have the support of most of the main armed forces in the capital, but some back Bashagha.
"Because there's no political outlet for discussion and no political process, it makes clashes more likely," said Emadeddin Badi of the Atlantic Council.
"The fact there are two governments is exacerbating these tensions."
Armed group leaders have been able to secure state salaries for their fighters and access to government contracts in return for allegiance to political figures over the past decade, a senior Libyan state official said.
When Bashagha tried to enter Tripoli last month, clashes broke out between rival groups, forcing him to quit the city.
Most of the major armed factions have long been integrated into state pay rolls with official roles under the interior or defence ministries, though they answer to their original leaders rather than to the government.
SHOOTING
In a uniform shop in central Tripoli, the walls are hung with an array of colours and camouflage patterns, tactical gear and a board displaying insignia for the numerous military or security forces, showing the big number of armed groups.
During a five-minute drive along a main Tripoli road from Souk al-Thulatha on the day before the shooting, Reuters counted more than 20 security vehicles with 11 different liveries, ostensibly showing them to be forms of police or army.
At night, city roundabouts are lit by the flashing blue and red lights on security vehicles, idling by the access roads while fighters in an array of uniforms and bearing assault rifles, sometimes with masks over their faces, question drivers.
Periodically, a force moves through the city in an armed convoy with tens of vehicles, the uniformed fighters standing in the back of pick-up trucks mounted with heavy machine guns.
Waiting in the wings, eastern commander Khalifa Haftar, an ally of the parliament that appointed Bashagha, could take advantage of any conflict between the Tripoli armed groups.
Haftar's supporters present him as an antidote to the chaos and lawlessness of rule by rival armed groups in western Libya.
However, his own Libyan National Army is also a coalition of different armed factions and a U.N. panel of experts on Libya has reported numerous abuses associated with it.
(Reporting by Angus McDowall, Editing by William Maclean)