Armed groups defending Libya’s capital from an offensive by Egyptian and Emirati-backed warlord Khalifa Haftar have obtained drones for the first time and begun to deploy them along the front lines, a senior official told The Independent.

Khaled al-Meshri, president of Libya’s High Council, confirmed in an interview that the United Nations-backed Government of National Accord had obtained unmanned drones in the last few days and modified them to counter the devastating effect of Mr Haftar’s war planes and aerial surveillance capabilities.

“Yes, we have drones,” he said. “Our aerial capacity has gotten better. The logic is overwhelming here, that the more time goes, the better we get. We didn’t expect this war.”

Mr Haftar, a self-declared “field marshal” has rallied an army and established control over eastern and southern Libya.

He stunned international observers and surprised even some of his own backers by launching an offensive on 4 April to take control of the capital, Tripoli.

The city is the seat of the United Nations-backed authority that governs much of the country’s west and is recognised by the world as the country’s legal government.

Battle for Tripoli: In Pictures Show all 10 1 /10 Battle for Tripoli: In Pictures Battle for Tripoli: In Pictures Screengrab from a video published on the LNA’s War Information Division’s Facebook page on 16 April shows a fighter running while firing a machine gun reportedly in a southern suburb of Tripoli AFP/Getty Battle for Tripoli: In Pictures Smoke rising from an airstrike behind a tank belonging to forces loyal to Libya’s Government of National Accord during clashes in the Tripoli suburb of Wadi Rabie AFP/Getty Battle for Tripoli: In Pictures Fighters loyal to the government run for cover during clashes with forces loyal to Khalifa Haftarsouth of the capital Tripoli's suburb of Ain Zara, on 25 April 2019 AFP/Getty Battle for Tripoli: In Pictures Forces loyal to the internationally recognised Government of National Accord (GNA) take aim during clashes with forces loyal to strongman Khalifa Haftar south of the capital Tripoli's suburb of Ain Zara on 23 April 2019 AFP/Getty Battle for Tripoli: In Pictures A displaced Libyan family, who fled their house because of the fighting in Tripoli, sits at the industrial complex, which is used as a shelter, in the capital on 16 April 2019 Reuters Battle for Tripoli: In Pictures A technical (pickup truck mounted with a turret) firing reportedly during clashes with forces loyal to Libya's UN-recognised Government of National Accord (GNA) on the outskirts of the capital Tripoli on 24 April 2019 AFP/Getty Battle for Tripoli: In Pictures Government forces look out from a destroyed building in the Khallat Farjan area of Tripoli on 20 April 2019 Reuters Battle for Tripoli: In Pictures A Libyan fighter loyal to the Government of National Accord (GNA) fires a machine gun during clashes with forces loyal to strongman Khalifa Haftar south of the capital Tripoli's suburb of Ain Zara, on 10 April 2019 AFP/Getty Battle for Tripoli: In Pictures Two men stand at the scene of an overnight rocket attack, which no group claimed responsibility for so far, in the Libyan capital of Tripoli on April 17 Photos AFP/Getty Battle for Tripoli: In Pictures Libyan National Army members, commanded by Khalifa Haftar, head out of Benghazi to reinforce the troops advancing to Tripoli on April 7 2019 Reuters

The war, now on Tripoli’s outskirts, has turned into a battlefield stalemate, with back-and-forth mortars and rocket barrages inflicting casualties and destroying buildings – but barely changing the front around 10 miles from the centre of the capital of 3 million. Nearly 500 people have been killed and at least 2,150 wounded. Some 70,000 people have been displaced.

Mr Meshri, a former member of the Libyan branch of the Muslim Brotherhood organisation considered an ideological enemy by Egypt and the United Arab Emirates, said his government was focused on defending the capital and dislodging Mr Haftar’s forces from his strongholds in the cities of Tarhouna and Garyan, south of the capital.

“If we push him out of Tarhouna and Garyan, the war is over, he’ll lose even in the east,” he said in an interview, held in a suite in a Tripoli hotel that doubles as a government office.

Avoiding the bluster of many Libyan officials and military commanders, he was tempered about the capabilities of the collection of armed groups that make up the GNA force. The most powerful are the brigades from Misrata, the Libyan port city which bore the brunt of the 2011 war against former dictator Muammar Gaddafi and the 2016 war to dislodge Isis from the city of Sirte.

Fighters loyal to the government run for cover during clashes with Khalifa Haftar forces (AFP/Getty Images) (AFP/Getty)

“It is difficult to say that Haftar is retreating, but we can say that he didn’t achieve the goals he aspired to,” said Mr Meshri, who serves as the equivalent of speaker of parliament for the GNA.

“We can say that the GNA forces have succeeded in foiling Haftar’s offensive. The next phase is the GNA advancing in terms of military tactics.”

Drones obtained by the GNA force will likely be a crucial part of those tactics.

Mr Haftar’s surveillance drones scour the skies over GNA positions at night, followed by airstrikes that have destroyed military vehicles, inflicted casualties, and occasionally struck civilians.

The Independent spotted at least one GNA drone in a box. “You know the drones you can buy on Amazon? That’s the ones we’re talking about,” said one fighter, downplaying their impact. “There’s a guy who gets them. And some people who modify them.”

Mohamed Eljarh, a noted Libyan analyst, cited reports of unscheduled flights between Turkey and Misrata and speculated that the drones were given by President Recep Tayyip Erdogan, a staunch supporter of the GNA.

Some of the fighters on the ground also hinted that the drones came from a foreign ally.

The GNA forces have been struggling to get weapons, despite a UN arms embargo imposed on Libya that the UAE and Egypt do not seem to be honouring. Tripoli and Misrata officials say that though their allies in Turkey and Qatar provide media and diplomatic support, they’ve been reluctant to help with weapon shipments.

Mr Haftar’s forces have obtained Russian-made Tigr armoured vehicles that can’t be stopped by rocket-propelled grenades. Libyan officials are seeking to procure weapons to counter both the drones and the vehicles.

A fighter, thought to be in a southern suburb of Tripoli, runs while firing a machine gun (AFP/Getty)

“They only need guns for the drones and the Tigr armoured vehicles,” said Jamal Abdul Motaeleb, a former adviser to the foreign ministry who is now a political analyst. “Qatar has offered to pay for them. But it has said it can’t send them directly, and that best thing to do is to buy them via the black market.”

Mr Meshri said weapons procurement was a priority for the GNA, noting that during the 2011 war against Gaddafi some of the rebel brigades in Misrata retrofitted factories to make their own weapons and military vehicles.