An air strike hit a detention centre for mainly African migrants in a suburb of the Libyan capital Tripoli late yesterday, killing at least 44 people and wounding more than 130, the United Nations has said.

It was the highest publicly reported toll from an air strike or shelling since eastern forces under Khalifa Haftar launched a ground and aerial offensive three months ago to take Tripoli, the base of Libya's internationally recognised government.

UN Libya envoy Ghassan Salamé condemned the strike, saying it "clearly amounts to the level of a war crime".

UN Secretary-General Antonio Guterres said he was outraged by the air strike and called for an independent investigation, his spokesman said.

UN human rights chief Michelle Bachelet said it was the second strike on the centre during the recent fighting, even though its coordinates had been communicated to the warring sides.

Libya is one of the main departure points for African migrants, fleeing poverty and war, to try to reach Italy by boat, but many are picked up and brought back by the Libyan coast guard, supported by the European Union.

Some 6,000 are held in government-run detention centres in what human rights groups and the UN say are often inhuman conditions.

The UN's refugee agency called in May for the Tajoura centre, which holds 600 people, to be evacuated after a projectile landed less than 100 metres away, injuring two migrants.

The hangar-type detention centre is next to a military camp, one of several in Tajoura, east of Tripoli's centre, which have been targeted by air strikes for weeks.

Frightened migrants were still at the detention centre after the strike, which partially destroyed the hangar.

"Some people were wounded, and they died on the road, on their way running,and some people are still under the debris so we don't know what to say," said Othman Musa, a migrant from Nigeria.

"All we know is we want the UN to help people out of this place because this place is dangerous," he said.

"Our teams had visited the centre just yesterday and saw 126 people in the cell that was hit. Those that survived are in absolute fear for their lives," medical charity Médecins Sans Frontières said in a statement.

Tajoura, east of Tripoli's centre, is home to several camps belonging to forces allied to the internationally recognised government, which have been targeted by air strikes for weeks.

Photos showed African migrants undergoing surgery in a hospital after the air strike. Others lay on beds, some covered in dust or with bandaged limbs.

"Our teams had visited the centre just yesterday and saw 126 people in the cell that was hit. Those that survived are in absolute fear for their lives," medical charity Médecins Sans Frontiéres said in a statement.

Haftar's Libyan National Army (LNA), allied to a parallel government based in eastern Libya, has seen its advance on Tripoli held up by robust defences on the outskirts of Tripoli, and said it would start heavy air strikes after "traditional means" of war had been exhausted.

His attempt to capture the city has derailed UN attempts to broker an end to the chaos that has prevailed in the oil-and gas-producing north African country since the violent, NATO-backed overthrow of Muammar Gaddafi in 2011.

The UN called for an independent investigation and for perpetrators to be held to account.

In a statement, the Tripoli-based government blamed the "war criminal Khalifa Haftar" for the incident.

The LNA denied it had hit the detention centre.

Today, the LNA conducted another air strike on Tripoli's only functioning airport, which also has a military section, causing the closure of civilian traffic.

LNA spokesman Ahmed Mismari said the strike had destroyed a drone control room.

The LNA air campaign has failed to take Tripoli in three months of fighting, and last week lost its main forward base in Gharyan to Tripoli's forces.

Both sides enjoy military support from regional powers.

The LNA has been supplied for years 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 disrupt oil supplies, boost migration across the Mediterranean to Europe, scupper UN plans for an election to resolve the rivalry between the parallel administrations in east and west, and create a security void that Islamist militants could fill.