It has been devastating and heart-breaking to watch the Taliban’s rapid advance in Afghanistan over the last week. Afghans who sought to rebuild their country based on liberty and democratic freedoms now fear for their lives, particularly women and minorities who were led to believe the future would look very different from that which now confronts them.

While life under the Afghan Governments of the last 20 years has been very far from ideal, we can be proud of much that was achieved since 2001: a huge programme of landmine clearance, many more Afghans accessing electricity, clean water and healthcare, millions of girls accessing education for the first time, female judges and MPs, and infant mortality halved. No terrorist attack has been launched from Afghan soil in the last 20 years.

We should be proud of the role our armed forces played and remember the sacrifices they made. Many of our soldiers came home with life changing injuries, and 457 of them lost their lives in Afghanistan.

The Taliban are now back in control, and we cannot be naïve about the consequences of that. It threatens to undo the progress of the last 20 years and make Afghanistan a safe haven for terrorists once again.

Nobody believes that we and our allies could have remained in Afghanistan indefinitely or that retaining a significant presence was ever realistic following the United States’ decision to fully withdraw.

However, the events of the last week show what a catastrophic miscalculation we and our allies made about the relative strength of the Afghan security forces and the Taliban. As recently as last month, the Prime Minister told the House of Commons: “I do not believe that the Taliban are guaranteed the kind of victory that we sometimes read about” and “I am sure they will be aware that there is no military path to victory”. The idea that withdrawal would lead to a military stalemate, forcing the Taliban to compromise with President Ashraf Ghani’s Government, couldn’t have been more misguided.

Clearly, this isn’t the only error we’ve made in Afghanistan. There have been a series of misjudgements by political leaders on both sides of the Atlantic over a prolonged period, and we need to learn the lessons of our 20 years in Afghanistan.

We aren’t going to see a reassessment of British foreign policy in the short-term, but the Government must begin to urgently rethink its disastrous refugee policy, and focus on getting Afghans most at risk out of the country as soon as possible, along with remaining UK nationals.

The UK Government scheme announced yesterday, for example, aims to resettle 20,000 Afghan refugees over 5 years – and only 5,000 this year. That just doesn’t match the scale of this crisis. It seems to be based on the Government’s scheme for Syrian refugees, which also promised to resettle 20,000 people, even though Afghanistan has a population twice that of Syria and, unlike Syria, has had an extensive UK military presence for 20 years.

We could and should have been much better prepared for the need to secure regional and international agreements on refugees, resettle people in the UK and ensure effective, ongoing humanitarian assistance. We’ve had 18 months since President Trump announced the full withdrawal of troops to do that. We can’t just leave Afghanistan and shut the door on others who want to follow – it risks leaving people in danger and undermines our credibility in co-ordinating an international humanitarian response. We owe it to the Afghan people to produce a more generous and comprehensive plan.

The Taliban’s victory is a catastrophic failure for the UK and the US. We fought for 20 years to rid Afghanistan of extremism, but what we left in place collapsed within days. The Taliban regained control before our withdrawal was even complete. The consequences are ongoing suffering for the Afghan people, particularly women and minorities, the possibility of renewed civil conflict, a more unstable global environment, and an increased terror threat in the UK. As Keir Starmer rightly said today, that is the cost of careless leadership.