At least six migrants were shot dead at an overcrowded Tripoli detention facility on Friday, according to the International Organization for Migration (IOM).
"Shooting broke out and six migrants were killed in total. They were shot by the guards," the UN agency's Libya chief Federico Soda said in a statement.
"We don't know what triggered the incident today but it is related to overcrowding and the terrible, very tense situation" at the Al-Mabani facility in the capital, he said.
He added that at least 20 other migrants were wounded and that many more had escaped in the chaos.
The killings came a week after sweeping raids in Tripoli, mostly targeting irregular migrants, left at least one person dead and 15 wounded, according to the UN Support Mission in Libya (UNSMIL).
Doctors without Borders (MSF) said 5,000 migrants and refugees had been swept up in "violent mass arrests", tripling the numbers detained in the city in just five days.
Libyan authorities had said the wave of detentions last Friday and Saturday were part of anti-drug raids on houses and makeshift shelters in Gargaresh, a poor suburb of Tripoli.
Soda said the heavily guarded Al-Mabani centre, which has a capacity of 1,000, had by Friday been housing 3,000 migrants, mostly from sub-Saharan Africa, around a third of them in the grounds outside the building.
"Guards had fired into the air to control previous incidents during the week," he said.
"Their detention is arbitrary and indiscriminate," he said.
"There are people there who have legal documents but they are stuck in the country."