Libya looks certain to be the next flashpoint in the “war on terror” with a crucial political deadline approaching today. As Royal Air Force (RAF) jets are already over desert skies and President Obama is telling the Pentagon to look at military options, it seems that the west is ready to take on the 6,000 Islamic State (IS) fighters in the vast, oil-rich sands of north Africa. Tunisia is so worried by the build-up of Islamists on its doorstep that it has begun to build an anti-terror barrier along its border with Libya – a desperate attempt to protect itself from terrorism. In the ever-spiralling war against terror, Libya now matters to everyone. But the effort to address the threat is being impeded by the body that should be leading the response: the United Nations. Foreign forces would have to be invited in by a Libyan government. The problem is not that there is not such a government. The problem is that there are three. To the administrations in Tripoli and Tobruk, the United Nations added a third – a “unity government” in Tunisia: one so fractured that three of its nine-member presidential council reportedly came to blows recently. Endorsed by the UN in December, the administration has said it will come up with a list of ministers that everyone can agree on by tonight. To make matters worse, everything the UN does now is tainted by Libyan concerns about its credibility. Much of that concern relates to the role of the former UN peace envoy, Bernardino Léon. Léon, a former Spanish foreign minister, spent weeks last summer completing the proposed agreement between the two sides to form a power-sharing unity government. Those talks were meant to put to rest the intense, but largely hidden, competition between regional players such as the United Arab Emirates, Saudi Arabia and Qatar, and their client states over influence in Libya, whose oil and gas reserves make the nation a valuable piece of global real estate. But analysts say the UN’s credibility as an honest broker in those talks was dramatically undermined when The Guardian revealed emails showing that while Léon was drafting the accord, he was also negotiating to become the £35,000-a-month director general of UAE’s “Diplomatic Academy”, a potential conflict of interest. The emails, hitherto undisclosed, appear to show that Léon asks permission to proceed with a plan to name the Libyan ambassador to the UAE as a possible prime minister of the unity government. In one set Leon draws up a plan with the UAE’s national security council on how the Libyan armed forces could be run. For many Libyans these disclosures are profoundly shocking. Léon claimed there had been a “selective reading” of his emails and had similar communications with other regional players. But following publication of the emails, senior UN officials I spoke to confirmed that they were being subjected to “extraordinary pressure” from Gulf states. The UN could have conducted a transparent investigation and restored its credibility. Instead it replaced Léon with a veteran German diplomat. Léon took up his role with the Emirates Diplomatic Academy, and from this vantage point surfaced last month to pronounce Libya a “failed state”. This has not been the only misstep. From the outset the UN has failed to work with political forces on the ground to design administrations best suited to local traditions. This would have meant international partners handing over responsibility for anti-terror operations to Libyan forces of varying political complexions and – something the west and its allies have so far not been willing to contemplate – tolerating their attempts to dislodge IS. Instead militias, warlords and armed groups thrived as UN-backed processes failed to deliver governance or a politics that has popular support. The task in Libya has always been a daunting one. It has not been helped by the UN playing a difficult hand badly. A version of this article appeared in The Guardian on February 14, 2016