It is the highest publicly reported toll of an air strike or shelling since eastern forces loyal to Khalifa Haftar three months ago launched an offensive with ground troops and aircraft to take the capital held by the internationally recognised government.
The conflict is part of chaos in the oil-and-gas-producing nation since the NATO-backed overthrow of Muammar Gaddafi in 2011.
Malek Mersek, spokesman for a state emergency medical services, said 40 people had been killed and 80 wounded in the strike on the detention centre in the Tajoura suburb located next to a military camp.
WATCH: At least 2 dead, 25 missing as migrant boat capsizes off Libya
The Tripoli-based government said in a statement that dozens of people had been killed and wounded in an air strike blamed on the “war criminal Khalifa Haftar”.
Published photos showed African migrants undergoing surgery in a hospital after the strike. Others lay on beds, some covered in dust or with limbs bandaged.
Libya is a main departure point for migrants from Africa fleeing poverty and war and trying to reach Italy by boat, but many get picked up by the Libyan coast guard supported by the European Union, which wants to stop migration.
Thousands of migrants are held in government-run detention centres in western Libya in what human rights groups and the United Nations say are often inhuman conditions.
Tajoura, east of Tripoli’s centre, is home to several military camps of forces allied to Libya‘s internationally recognised government, which have been targeted by air strikes for weeks.
WATCH: Migrants in Libya detention camps left in limbo
On Monday, Haftar’s Libyan National Army (LNA), which is allied to a parallel government, said it would start heavy air strikes on targets in Tripoli after “traditional means” of war had been exhausted.
An LNA official denied his force had hit the detention centre, saying militias allied to Tripoli had shelled it after a precision air strike by the LNA on a camp.
The LNA air campaign has failed to take Tripoli in three months of fighting, and last week LNA lost its main forward base in Gharyan, which was taken back by Tripoli forces last week.
Both sides enjoy military support from regional powers. The LNA for years has been supplied by the United Arab Emirates and Egypt, while Turkey recently shipped arms to Tripoli to stop Haftar’s assault, diplomats say.
The conflict threatens to allow Islamist militants to fill a security void, disrupt oil supplies, boost migration across the Mediterranean to Europe, and scupper U.N. plans for an election to end rivalries between parallel administrations in east and west.