The catastrophic illusions and acts of official betrayal at the heart of the wars in Afghanistan and Iraq are being progressively exposed, one after another. In London, the former head of MI5 Eliza Manningham-Buller confirmed to the Iraq inquiry this week that the security service had indeed warned Tony Blair's government that aggression against Iraq, "on top of our involvement in Afghanistan", would violently radicalise a generation of young Muslims and "substantially" increase the threat of terror attacks in Britain.

And so it came to pass. A few days earlier, Carne Ross, Britain's former representative at the UN responsible for Iraq before the invasion, told the inquiry that the British government's statements about its assessment of the threat from Saddam Hussein "were, in their totality, lies". In due course, those lies were brutally exposed.

It's easy to be inured to the power of such indictments after nine years of the war on terror and its litany of torture, kidnapping, atrocities and mass killing. But together with a string of earlier revelations they do combine to highlight the utter disgrace of the British political and security establishment, which deceived the public about a war it was well aware in advance would expose them to great danger.

The reason for such official dissembling and recklessness is also now clear enough. The British commitment to join the attack on Iraq was transparently never driven by the supposed menace of Saddam or the legal casuistry advanced at the time, but by an overriding commitment to put Britain at the service of US power, under whoever's leadership and wherever that might take it at any particular time. The "blood price", as Blair called it, for this – David Cameron made explicit last week – subservient relationship had to be paid.

It is now being paid again in Afghanistan, as a new British government claims, against all the evidence, that its troops are dying to keep the streets of Britain safe from terrorism. David Cameron and his ministers have strained every nerve in recent weeks to give the impression that Britain's commitment to the Afghanistan war isn't open-ended. Yesterday, in the wake of yet another meaningless international conference on Afghanistan, the prime minister pledged to end the British combat role by 2015 while holding out the possibility of a start to withdrawal next year, based on "conditions on the ground".

It's scarcely surprising he feels the need to talk withdrawal. Up to 77% of the British public want troops out in a year. The £4bn annual price tag is hard to justify when you're slashing public spending. And the rising rate at which British troops are being killed is now proportionally far higher than their US counterparts. If it were to be maintained for the next five years, the British death toll would rise from 322 to over 1,000.

What would Cameron be asking those soldiers to die for? Not a single terror attack in Britain – or plot, real or imagined – has been sourced to Afghanistan. Al-Qaida has long since decamped elsewhere – to Pakistan, Iraq, Somalia and Yemen. Meanwhile, the strength of the Taliban-led guerrilla campaign continues to grow as the number of occupation troops increases, while Afghan civilians are dying in their thousands.

There's no reason to believe the situation will be fundamentally different in four years' time. All that those troops will be doing in the meantime is keeping the corrupt and unpopular Karzai government in the style to which it has become accustomed. But as one senior political figure who's held private discussions with Cameron about the war told me yesterday, the prime minister "has taken a decision to stick close to the Americans" and won't stray from the Obama administration's script.

The administration and US military, however, are themselves divided – about whether to switch strategy, when to reduce troop numbers, and whether and when to talk to the Taliban. So are Nato and the Europeans. And as opposition to the war hardens in both the US and Europe, Obama's presidency is now dangerously in hock to hawkish generals such as James Mattis, who declared in 2005 it was "a hell of a lot of fun to shoot" Afghans, and the overweening ex-Republican David Petraeus, whose Iraqi surge is supposed to be the model for winning the Afghanistan war.

The growing violence and disintegration of Petraeus's militias in Iraq should be a warning to those who imagine this is the way out of the Afghan maelstrom – as should the rebranding of US combat troops in Iraq to maintain their role after next month's scheduled withdrawal. In Afghanistan, while neither side is in a position to deliver a knockout blow, the direction of the war could not be clearer: Taliban attacks up more than 50% on last year, civilian deaths up 23%, and the prospect of "Afghanisation" no more credible than "Vietnamisation" was in another US war 40 years ago.

We are accustomed to the idea that Iraq has been a disaster; now we are getting used to seeing the war in Afghanistan in the same light. It has failed in every one of its ever-changing objectives – from preventing the spread of terrorism and eradicating opium production to promoting democracy and the position of women, which has actually deteriorated under Nato occupation according to Afghan women's groups.

What it has now really come to be about is the credibility of the US and Nato. There has long been an obvious way out of the Afghanistan imbroglio: withdrawal of foreign occupation troops, negotiated with all significant Afghan forces, including the Taliban, as part of a settlement guaranteed by the regional and other powers. The fact that a solution long backed by the war's opponents is now being taken up by its supporters is a measure of how badly things are going on the ground.

For what is now taking place in Afghanistan has the potential to reinforce what has already been demonstrated in Iraq: namely the limits of US power to impose its will by force. If the unmatched might of the American military can be seen off by a ragtag army in one of the poorest countries of the world, the implications for the new international order are profound. Which is why the US and its closest allies will do everything to avoid the appearance of defeat – and why many thousands more Afghans and Nato troops will pay the price of a war their leaders now accept can never be won.