John Baron is a member of the Foreign Affairs Select Committee and is MP for Basildon and Billericay.

Three years on, it is clear the West’s Libyan intervention has been a disaster. A vicious civil war, growing civilian casualties and refugees, and warring tribal and religious groups have gone largely unnoticed in Britain. Things are so bad that the Libyan Parliament is now taking refuge in a Greek car ferry in Tobruk’s famous harbour. As with most of our interventions over the last decade, it was never meant to turn out like this. As we once again contemplate intervention in Iraq and Syria, Libya offers chastening lessons.

The perimeter of Tobruk’s airport now forms the front line against a nascent Islamic caliphate in nearby Derna: any further east and the Libyan MPs will be in Egypt. Islamists are also in control of Tripoli and Benghazi, Libya’s second city. Last month, the Royal Navy mounted an emergency evacuation of British nationals, and the Foreign Office has ordered its staff out of the country. Other Western nations have followed suit. One Islamist group has even held a ‘pool party’ in the abandoned US Embassy. Meanwhile, the UAE and Egypt have conducted air strikes against extremists, without any consultation with the West.

We were told that Western intervention would avert an humanitarian catastrophe and prevent genocide in Benghazi – ironically now where the Islamists are arguably at their strongest. At the time of the vote, many of us in Parliament pointed out that not enough thought had been given to the challenges post-Gaddafi, to the various tribal and religious factions that would surface, and the knock-on effects beyond Libya’s borders. Some of us pointed to regional allies, who were more than capable of exercising control of the skies over Benghazi – after all, the West had been selling them tens of billions of pounds of kit for this very purpose.

Some of us also suspected the real motive was one of regime change. US anger following the Scottish release of Abdelbaset al-Megrahi was palpable. In February 2011, when the Foreign Affairs Select Committee met our American counterparts in Washington, the only topic they wished to discuss was not Afghanistan or Iraq, but the decision to release the Lockerbie bomber. We would not have been alone in picking up the negative vibes.

However, whatever the West’s motives, UN Security Council Resolution 1973 authorised the protection of civilians ‘by all means necessary’ other than a ‘foreign occupying force’. On the strength of this wording, and reassurances from London, Paris and Washington that regime change was not the objective, Russia and China did not use their Security Council vetoes.

Parliament voted on the issue as the jets were leaving the runway, and those of us who opposed intervention accepted defeat.

However, as the military intervention escalated, it is difficult to escape the conclusion that regime change was precisely what Western forces proceeded to pursue. Gaddafi was the target – even his Winnebago did not escape air strikes. Yet the Gaddafi state proved more resilient than had been anticipated. The short air campaign forecast by the Prime Minister and the French President did not materialise. Instead, we scrambled to increase our firepower, bodge-flying Apache attack helicopters off Royal Navy ships. Even with this force at their disposal, Libyan fighters still took nearly six months to declare victory.

Almost as soon as their common enemy was killed – distastefully, a trial not being the objective – events went downhill very quickly with the various militias turning against each other. ‘Turfs’ were staked out; checkpoints were established and manned.

The first elections, in July 2012, were judged to be a success for moderates over the Muslim Brotherhood (MB). However, this belief belied a lack of rigour and analysis: although moderate parties did well, the majority of MPs were elected as independents.

Over the coming months, many sided with either the MB or other Islamist groups, sowing sectarianism and political violence. Growing instability, together with a sea of fighters and small-arms, spilled over Libya’s borders, playing a major part in the insurgency in Mali and the attack on the In Amenas gas facility in Algeria.

As with Iraq, it is clear that post-war planning was woefully inadequate. Western diplomats continued to engage with the General National Congress (GNC) long after it was obviously in the pocket of Islamists – which did nothing to endear them to genuine moderates – giving dangerous militias credibility and reinforcing their position. The worsening security situation has persuaded most Western embassies to close entirely, ending almost all contact and support for the nascent Libyan state.

In May 2013, the GNC passed a disastrous ‘Political Isolation Law’, which excluded anyone who had been in public service under Gaddafi. At a stroke, this barred many of the emerging moderate political establishment from holding public office. Libya has been in a tailspin ever since.

Meanwhile, the Libyan Parliament, elected in June on a miniscule turnout of 18 per cent and increasingly irrelevant, continues to bob about in Tobruk harbour. In many ways, they symbolise the dangers of the West’s short-termism in foreign affairs. Ousting Gaddafi was always going to be the easy part: creating a successor state from scratch was clearly the bigger challenge.

If regime change was the objective, then perhaps Libya post-Gaddafi was never really going to be a concern. However, if one accepts the West’s declared motive, then once again it has been found wanting.

A lack of rigorous assessment as to the difficulty of removing Gaddafi; of post-Gaddafi planning; of understanding the various components and parties in theatre, and of the consequences, both in the vast swathes of territory in the south of the country and beyond Libya’s borders – these were just some of the errors committed: a lack of local knowledge perhaps being the common denominator. Years of cuts to the FCO budget, and the consequent dilution of skills, was a factor.

Libya is a good example of how not to intervene. Knocking the door down is always going to be the easy part. The post-intervention planning was once again the Achilles’ heel. As the West once again stands poised to intervene in Iraq and Syria, such lessons must be heeded. The consequences of getting it wrong there could be much greater.