The Tripoli-based government blamed the attack on forces associated with Gen. Khalifa Hifter, whose Libyan National Army has been waging an offensive against rival militias in the capital of the war-torn North African country since April.
It refocused attention and raised questions about the European Union's policy of cooperating with the militias that hold migrants in crowded and squalid detention centers to prevent them from crossing the Mediterranean to seek better lives in Europe. Most of them were apprehended by the Libyan coast guard, which is funded and trained by the EU to stem the flow of migrants.
At the United Nations, the Security Council held a closed emergency session on the airstrike in Tripoli's Tajoura neighborhood, and Secretary-General Antonio Guterres called for an independent investigation.
Hifter's forces said they were targeting a nearby military site, not the detention center. There also were suspicions of involvement by foreign countries allied with his forces. Countries assisting Hifter include Egypt, the United Arab Emirates and Russia.
Two migrants interviewed by The Associated Press said the airstrike hit a compound that houses a weapons warehouse and an adjacent detention center holding about 150 migrants, including several Sudanese and Moroccans. The two spoke on condition of anonymity for fear of reprisal.
Online video purported to be from inside the detention center showed blood and human remains mixed with rubble and the belongings of the victims. The U.N. gave an initial figure of 44 dead and more than 130 wounded. But the two migrants told the AP that three or four escaped harm and about 20 were wounded. They said the rest were killed, indicating the final death toll could be much higher. A Moroccan consular official said 15 Moroccans were in the center and at least three were slightly injured. The fate of the others was unclear. The official was not authorized to be publicly named according to government policy.
Prince Alfani, the Libya medical coordinator for Doctors Without Borders, visited the detention center hours before the airstrike and said it had held 126 migrants. Survivors fear for their lives, he said, urging their immediate evacuation.
Charlie Yaxley, a spokesman for the U.N. refugee agency, said the detention center's proximity to the weapons depot "made it a target for the airstrikes." "Coordinates of this detention center were well-known to both sides of the conflict," Yaxley said. "It was known that there were 600 people living inside. So there can be no excuse for this center having been hit."
He said the agency had warned less than two months ago that anyone in the complex could be caught in the fighting and an earlier airstrike nearby had wounded two migrants. The UNHCR is sending medical teams to the site, he added.
U.N. human rights chief Michelle Bachelet said the attack "may, depending on the precise circumstances, amount to a war crime." The attack "killed by surprise innocent people whose dire conditions forced them to be in that shelter," said U.N. envoy for Libya Ghassan Salame.
Magdalena Mughrabi, deputy Middle East and North Africa director for Amnesty International, said the attack "must be investigated as a war crime" by the International Criminal Court. The deaths are the "consequences of Libya and Europe's callous migration policies," she said.
The group said its research indicated a weapons storage warehouse was in the same compound as the detention center and some of the migrants were forced to work at the military site. The Tripoli-based Government of National Accord, which is backed by the U.N., called for an investigation by the world body.
Libya became a major crossing point for migrants to Europe after the overthrow and death of longtime dictator Moammar Gadhafi in 2011, when the North African nation was thrown into chaos, armed militias proliferated and central authority collapsed.
At least 6,000 migrants from Eritrea, Ethiopia, Somalia, Sudan and other nations are locked in dozens of detention facilities in Libya run by militias accused of torture and other abuses. There is limited food and other supplies for the migrants, who often end up there after arduous journeys at the mercy of abusive traffickers who hold them for ransom from their families. More than 3,000 migrants are in danger because they are held in detention centers near the front lines, the U.N. refugee agency said.
"This incident underscores the urgency to provide all refugees and migrants with safe shelter until their asylum claims can be processed or they can be safely repatriated," U.N. spokesman Stephane Dujarric said.
Gen. Khaled el-Mahjoub, a spokesman for Hifter's LNA forces, denied targeting the detention center, saying it was the militia camp in the Tajoura neighborhood that was the target. He did not deny, however, that the migrant detention center was hit.
"We didn't give orders to target the shelter," he said. Later Wednesday, LNA spokesman Ahmed al-Mesmari also denied that its forces targeted the detention center and said the U.N. should investigate. He also blamed another militia in Misrata for airstrikes south of Tripoli that killed children in what he termed "a terrorist operation."
The EU urged Libyan authorities to better protect migrants, with its top diplomat and two top policy commissioners saying the attack highlights "the dire and vulnerable situation of migrants caught up in the spiral of violence."
Although the attack could increase greater Western pressure on Hifter, Claudia Gazzini, a Libya expert at the International Crisis Group, said it was highly unlikely to change the course the fighting in and around Tripoli.
"For both Hifter-led forces and those loyal to the Tripoli-based government, this is an existential war that sees little room for compromise," she said. She did not expect any actions other than a "verbal condemnation" of Hifter's forces if it is proven they were behind the airstrike.
Hifter, who receives support from Egypt, the UAE and Saudi Arabia, says he is determined to restore stability to the North African country. His rivals, mainly Islamists, are supported by Turkey and Qatar.
His forces control much of Libya's east and south but suffered a significant blow last week when militias allied with the Tripoli government reclaimed Gharyan, a town about 100 kilometers (62 miles) from the capital and a key LNA supply route.
On Monday, the LNA said it had begun an air campaign on rival forces in Tripoli. El-Mesmari, the LNA spokesman, said air forces had destroyed the main control room for drones at Mitiga airbase in Tripoli. Mitiga airport, the capital's only functioning airport, said earlier it had suspended civilian traffic following an airstrike.
Fathi Bashagha, interior minister of the Tripoli-based government, alleged that Hifter's foreign allies were behind the airstrike at the detention center and told the AP that they "went mad" after his forces lost Gharyan. He did not identify any countries or provide any supporting evidence. He also denied weapons were stored at the detention facility complex.
Security analyst Oded Berkowitz said the LNA has "a handful of obsolete aircraft" in poor condition. He said it has received spare parts and decommissioned aircraft from Egypt and possibly Russia. "Egypt and the UAE have been conducting air operations on behalf of the LNA, but there are no indications that the UAE transferred aircraft to the LNA," he said.
The fighting for Tripoli has threatened to plunge Libya into another bout of violence on the scale of the conflict that ousted Gadhafi. Hifter's campaign against Islamic militants across Libya since 2014 won him growing support from world leaders concerned that Libya has become a haven for armed groups and a major conduit for migrants. But critics view him as an aspiring autocrat and fear a return to one-man rule.
Magdy reported from Cairo. Associated Press writers Maggie Michael in Cairo, Edith M. Lederer at the United Nations and Angela Charlton and Lori Hinnant in Paris contributed.