Allies and critics alike on Monday condemned the United States over its 20-year NATO campaign in Afghanistan, with a leading German politician slamming the operation as "the biggest debacle" in the alliance's history.

Stunned by the Taliban's lightning advance across the country after the departure of Western troops, NATO allies have been left scrambling to evacuate their nationals as well as vulnerable Afghans.

The Taliban's return to power and chaotic scenes of people desperately seeking to flee Kabul on Western military aircraft have sparked criticism of the two-decade operation, which cost the alliance thousands of lives and over a trillion dollars.

Chancellor Angela Merkel said the US-led NATO operation achieved less than planned, adding she shared the pain of families of soldiers killed "as it seems right now like it was all in vain".

The deployment effectively ended Al-Qaeda's ability to launch another operation on the scale of its September 11, 2001 attack on the United States, but "everything else that has followed has not been as successful and has not been achieved in the way that we had planned", Merkel said.

German Foreign Minister Heiko Maas: 'All of us -- the federal government, intelligence services, the international community -- misjudged the situation'
German Foreign Minister Heiko Maas: 'All of us -- the federal government, intelligence services, the international community -- misjudged the situation' AFP / Odd ANDERSEN

Lessons must be drawn, she said.

"You also have to set smaller goals, I think, in such missions."

The Taliban's return to power was "particularly dramatic and terrible", she said.

"It is terrible for the millions of Afghans who had worked for a freer society and who, with the support of the Western community, have focused on democracy, on education, on women's rights," she said.

There were chaotic scenes at the airport in Kabul as thousands of people scrambled to get any flight out of the country
There were chaotic scenes at the airport in Kabul as thousands of people scrambled to get any flight out of the country AFP / Wakil Kohsar

In a meeting with her party's top brass earlier on Monday, Merkel had said that once the US decided to withdraw it was clear that other allies had to follow suit.

The decision was "ultimately made by the Americans", and "domestic political reasons" were partly to blame, said the chancellor, according to people in the meeting.

"The troop withdrawal sparked a domino effect" that culminated in the Taliban's return, said Merkel, whose country provided the second-biggest contingent of troops after the US.

The leader of her party had harsher words, calling the entire Afghanistan operation NATO's worst disaster.

"It is the biggest debacle that NATO has suffered since its founding," said Armin Laschet, who is the conservative candidate to succeed Merkel as chancellor in September's elections.

German Foreign Minister Heiko Maas: 'All of us -- the federal government, intelligence services, the international community -- misjudged the situation'
German Foreign Minister Heiko Maas: 'All of us -- the federal government, intelligence services, the international community -- misjudged the situation' AFP / Odd ANDERSEN

The focus at the moment must be on the German military's evacuation operation, he said.

"But we will talk about the causes and conclusions drawn after this rescue mission -- a no-holds-barred analysis of errors in Germany, with our allies and in the international community," he said.

Striking a more diplomatic note, Foreign Minister Heiko Maas said the failure to anticipate the Taliban's swift advance was a collective error.

"All of us -- the federal government, intelligence services, the international community -- misjudged the situation," Maas told a press conference.

Britain has also slammed the American decision to leave Afghanistan, with Defence Secretary Ben Wallace warning on Friday that the Taliban's resurgence would create a breeding ground for extremists that threatened the world.

"Of course Al-Qaeda will probably come back," he said, warning that would lead to "a security threat to us and our interests".

"I felt that that was a mistake to have done it that way, that we'll all, as an international community, probably pay the consequences of that," Wallace said of the Doha agreement signed between the United States and the Taliban.

The agreement, signed under former president Donald Trump last year, would have seen the US withdraw all its troops by May 2021 in exchange for security guarantees from the Islamist hardliners.

When Joe Biden took power earlier this year, he pushed back the deadline for the withdrawal to August 31.

Like Merkel, Wallace said the deal cut by Trump left Britain with no choice but to pull out too.

The rare criticism of the US's role by allies dovetailed with negative voices from China and Russia.

Beijing has repeatedly lambasted what it sees as the hasty withdrawal from Afghanistan as a failure of leadership, while Moscow has said the pullout meant the US had failed in its mission in Afghanistan.

For Wallace, the Taliban takeover was "a failure of the international community to not realise that you don't fix things overnight".