Guards shot dead six migrants at an overcrowded Tripoli detention facility on Friday, the International Organization for Migration (IOM) said.
"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.
The killings came a week after sweeping raids in Tripoli, mostly targeting irregular migrants, left at least one person dead, 15 wounded and 4,000 in detention, according to the UN Support Mission in Libya (UNSMIL).
Libyan authorities had labelled the wave of detentions last Friday and Saturday as part of an 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, was now 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, adding that many had escaped in the chaos.
"Their detention is arbitrary and indiscriminate," he said. "There are people there who have legal documents but they are stuck in the country."
A video posted on social media, filmed from a car, appeared to show hundreds of people climbing over a metal fence and running across the road.
AFP was unable to immediately verify the footage.
The UN's refugee agency UNHCR had said earlier Friday that it was "increasingly alarmed about the humanitarian situation for asylum seekers and refugees in Libya".
"Following a large-scale security operation by the Libyan authorities in the past week, arrests and raids have been taking place in many parts of Tripoli, targeting areas where asylum seekers and migrants are living," it said.
Particularly since Libya collapsed into violence following its 2011 revolution, it has become a key departure point for tens of thousands of migrants, mainly from sub-Saharan Africa, hoping to reach Europe.
Official centres for migrants detained in war-battered Libya are riddled with corruption and violence, including sexual assault, according to the United Nations and rights groups.
Human traffickers have profited from the country's years of chaos to carve out a lucrative but brutal trade.