Libya, a large oil producer, has been engulfed in chaos since 2011 when longtime leader Muammar Gaddafi was killed in an uprising.
It is now split between two rival administrations: the internationally backed Government of National Accord (GNA) led by Prime Minister Fayez al-Sarraj, and the House of Representatives allied to renegade military commander Khalifa Haftar and his Libyan National Army (LNA).
A crumbling ceasefire, brokered by the Russian and Turkish presidents, has been in place since earlier this month.
"Different armed groups and external powers are currently involved in the Libyan civil war. The conflict seems likely to intensify and become deadlier, making life even more precarious for the country's refugee and migrant population, "Jeff Crisp, a research fellow at the Refugee Studies Centre, University of Oxford, told Al Jazeera.
"Those being held in detention centres will be at greatest risk of aerial bombing raids," added Crisp, a former head of policy, development and education at the UN refugee agency.
'Atmosphere of chaos'
In addition to the ceasefire agreement, there have been various diplomatic efforts taking place, with al-Sarraj and Haftar called for various meetings with world powers. But there has been no reduction in violence in Libya.
Earlier this month, Turkish President Recep Tayyip Erdogan said Ankara was deploying military units to Libya to support the GNA. On Friday, he said the personnel will support and train GNA forces before adding that "if calm is not established as soon as possible, the atmosphere of chaos in Libya will affect all the Mediterranean basin."
"Any escalation in fighting is going to put all civilians, including migrants, at even greater risk," Safa Msehli, spokesperson for the International Organization for Migration (IOM) told Al Jazeera.
"Detained migrants are especially vulnerable and are at heightened risk as some of the detention centres are in proximity to clashes. The situation in Libya for people that find themselves in areas of active conflicts is already very difficult, and if the fighting were to escalate it would get significantly worse."
About 4,500 people are currently held in "official" detention centres across Libya. Thousands more are held in "prisons" run by armed groups.
Vulnerable to militia groups
Libya's conflict has also driven migrants and refugees to the sea in the hope of reaching Europe, across one of the deadliest migration routes in the world.
Since 2016, almost 12,000 refugees and migrants have drowned in the Mediterranean while trying to reach Europe.
"If the conflict continues to escalate, refugees and migrants are certain to seek ways of escaping from the country, using both land and sea routes," said Crisp.
"The majority will have to find their own way out of the country, leaving them vulnerable to militia groups, criminals, traffickers and smugglers. Looking to the future, there is also a distinct possibility that a growing number of Libyan citizens will try to leave the country by boat."
The IOM has called for an end to detention in Libya, adding that the centres' close proximity to clashes makes those detained more vulnerable and at a heightened risk.
"Any escalation in fighting is going to put all civilians, including migrants, at even greater risk," Msehli added.
"Ending detention in Libya and the adoption of alternative solutions that safeguard lives are of utmost urgency."