An airstrike hit a detention centre for migrants early Wednesday in the Libyan capital, killing at least 40 people, a health official in the country’s UN-supported government said.

The airstrike targeting the detention centre in Tripoli’s Tajoura neighbourhood also wounded 80 migrants, said Malek Merset, a spokesperson for the health ministry said. Merset posted photos of migrants who were being taken in ambulances to hospitals.

In a statement, the UN-supported government blamed the self-styled Libyan National Army (LNA), led by Khalifa Hifter, for the airstrike.

The LNA launched an offensive against the weak Tripoli-based government in April. Hifter’s forces control much of the country’s east and south but were dealt a significant blow last week when militias allied with the Tripoli government reclaimed the strategic town of Gharyan, about 100 kilometres from the capital.

Gharyan had been a key supply route for the LNA forces.

The fighting for Tripoli has threatened to plunge Libya into another bout of violence on the scale of the 2011 conflict that ousted longtime dictator Moammar Gadhafi and led to his death.

Thousands of migrants are detained in Libya after being apprehended by local forces funded by the European Union and are now caught up in the armed conflict. The centres have limited food and other supplies, and international agencies have called for speeding up resettlement of the migrants.