Politicians and the military are "culpable" for going into the war without fully thinking about the consequences, a former RAF officer has said.
Dr Afzal Ashraf, who served in Iraq and Afghanistan, told Sky News on Sunday that the UK went into the conflict for "all the wrong reasons".
It comes as efforts to evacuate UK troops and personnel from the country came to an end, drawing to a close Britain's 20-year engagement.
In an open letter, Boris Johnson told members of the Armed Forces, veterans, and loved ones of those who died serving in the military it was not down to "chance or good fortune" that the UK had been safe from attacks launched from Afghanistan for two decades.
But reflecting on the war, Ashraf said: "Our politicians and military are culpable for going into the war without thinking fully about the consequences."
He added: "They went into this conflict for all the wrong reasons and they are trying to spin it.
Watch: Johnson pays tribute to UK troops after 20-year engagement in Afghanistan
"This is a conflict that started off as a war on terror. We are now being told by our prime minister that because of the sacrifices that our troops are being made, we haven't been attacked from Afghanistan.
"But our forces really didn't go into Afghanistan several months or years after Bin Laden was removed."
Speaking about withdrawing from the country, he also said: "I was serving there about 10-11 years ago and my people, my soldiers and I knew then that this was going to end.
"The only remarkable thing about what has happened in the last week or so is that it has taken so long to happen."
"It is what is being spun that is hard to swallow. The continual changing."
Ashraf said the war is being spun as "some kind of victory against misogyny" with a new generation of educated women but those seen on TV and in interviews are not "the vast majority of the Afghan people".
"They're the ordinary people in the countryside that have had bombs rained on them, that have been caught in the crossfire for the last 20 years, that have had virtually no money of the billions and trillions spent on that war, spent to change their lives" he said.
Johnson on Sunday recognised the downfall of Afghanistan to the Taliban after 20 years would have been difficult to comprehend.
"Over the last two decades, many thousands of you dedicated years of your lives to service in Afghanistan, often in the most arduous conditions. In particular, I realise that this will be an especially difficult time for the friends and loved ones of the 457 service personnel who laid down their lives," he said.
But he repeated his message that their sacrifice was not in vain, and said: "Our purpose in Afghanistan was simple - to protect the United Kingdom from harm - and you succeeded in that central mission.
"In the last 20 years, not a single terrorist attack has been launched from Afghan soil against the UK or any other Western country. I know this was not down to chance or good fortune.
"Our country was protected because you joined with our allies to fight al Qaida, destroy its training camps, disperse or eliminate its leaders, and weaken its very core. I would not wish to contemplate what might have happened if you had not carried out this vital task.
"You kept al Qaida from our door for two decades and we are all safer as a result."
Watch: Last British troops return to UK from Kabul