Aid group Médecins Sans Frontières has called for the evacuation of thousands of people trapped in migrant detention centres in Libya's capital Tripoli.
The city is under a fragile ceasefire after deadly clashes.
The truce, brokered by the United Nations, was agreed between armed groups earlier this week after at least 63 people were killed in days of fighting around Tripoli.
MSF, also known as Doctors Without Borders, said migrants in squalid detention centres close to the frontline could yet come under shelling and artillery fire.
Analysts say the ceasefire is doomed without a sustainable political agreement between the multitude of armed groups.
Ibrahim Younis, MSF's mission chief in Libya, said food supplies to the detention centres were sparse as international groups had been forced to suspend their work due to the clashes.
The charity has been cut off from one of the most crowded detention centres, depriving 700 people of aid, and has pulled some staff from the city.
Last week, the UN's refugee agency, the UNHCR, said it had "evacuated" some 300 migrants from the Ain Zara detention centre to another a few kilometres away as they risked getting caught in the crossfire.
But Mr Younis said this was not good enough.
"Moving endangered refugees and migrants from one detention centre to another in the same conflict zone cannot be described as an evacuation and it is certainly not a solution," he said in a statement.
The aid group called on the UNHCR and the governments of peaceful countries to organise a mass evacuation for the migrants, who could then claim asylum.
The International Organisation for Migration could arrange for those seeking to return home to do so, MSF said.
The group also called on the European Union and Libyan authorities to stop blocking boatloads of migrants seeking to flee the conflict-torn country, "with the goal of reducing arrivals to Europe at all costs".
Sub-Saharan African migrants have suffered appalling abuses since Libya descended into chaos following the death of dictator Muammar Gaddafi in 2011.
A video showing African migrants being sold as slaves sparked global outrage last year.
Some 8,000 people picked up by the Libyan coastguard while trying to cross the Mediterranean to Europe are being indefinitely held in detention centres, according to the UNHCR.
EU countries have offered support and training to the Libyan coastguard in a bid to stem the influx of migrants to Europe.