US military said it lost the unmanned aerial vehicle while it was assessing security over Libyan capital Tripoli.

A US drone brought down over the Libyan capital last week was shot down by accident, a Libyan official said.

The US military said it lost contact with the unmanned aerial vehicle while it was conducting a security assessment and monitoring activity over Tripoli.

A senior official in the Libyan National Army (LNA) of eastern-based military commander Khalifa Haftar told The Associated Press the drone was mistaken for a Turkish UAV deployed by the UN-recognised Government of National Accord (GNA).

The official, who spoke on condition of anonymity, said the LNA apologised for shooting down the American drone and “agreed with the Americans to coordinate their operations over Tripoli and its surrounding areas to avoid similar incidents in the future”.

The Tripoli-based GNA acquired a number of Turkish-made Bayraktar TB2 drones while the UAE – which supports Haftar alongside Egypt, Saudi Arabia and France – has supplied the military commander with Chinese Wing Loongs.

Haftar has since April 4 waged a months-long offensive against the GNA, which he accuses of harbouring “terrorist” elements.

Libya, a major oil producer, was plunged into chaos when a NATO-backed uprising toppled longtime dictator Moammar Gaddafi in 2011.

It is now split between two rival administrations: the GNA led by Prime Minister Fayez al-Serraj, and the Haftar-allied House of Representatives.

On Saturday, the LNA imposed a “no-fly zone” over Tripoli saying all flights over the capital and nearby towns are “prohibited without prior coordination”.