The UN Support Mission in Libya has said it is "gravely alarmed" over new military mobilisations by rival groups in the Libyan capital.
In recent days, armed vehicles have reportedly moved into Tripoli from Misrata, around 200 kilometres away, and on Monday night gunfire was heard in the capital, according to witnesses and videos circulated online.
UNSMIL said the recent "rapidly escalating tensions and military mobilisation" in Tripoli "could lead to armed confrontation."
Sabiha Mohamad, a resident in western Tripoli, told AFP she had heard the gunshots.
UN voices worry over possibility of 'lose-lose war'
There were no official reports of casualties, and it remained unclear who fired the shots.
Libya is split between the UN-recognised government in Tripoli, led by Prime Minister Abdulhamid Dbeibah, and a rival administration in the east.
UNSMIL urged "all actors to cease any preparations for violence", warning they could spiral into a "'lose-lose' war."
In May, Tripoli was rocked by days of deadly fighting between rival armed groups that left at least eight people dead, according to the UN.
Tensions flare
The fighting came after Dbeibah announced a string of executive orders seeking to dismantle armed groups.
Tensions have been flaring between government-aligned groups and Rada, a rival faction that controls parts of eastern Tripoli.
Last month, UNSMIL chief Hanna Tetteh proposed a roadmap for "general election and the unification of institutions."
The plan looks to implement a "politically viable electoral framework" and "a new unified government", the UN said.