Trevor Royle has been a stalwart supporter of the West's intervention in Afghanistan.

But last week, two more British soldiers were killed in that conflict ... and he changed his mind. As this year's poppy appeal is launched, Scotland's leading military historian explains why it is time for the West

THERE comes a time when you have to stand still, take a deep breath and examine some of the certainties in your life. Contrary to popular expectation these are rarely Damascene moments – the flash of recognition that passes all understanding – but are the result of a steady concatenation of evidence. Such a moment arrived out of the blue from Afghanistan last week.

Curiously, it wasn't the announcement that 36 people had been killed on Friday morning in a bomb attack as worshippers were leaving the Eid Gah mosque in Maymana, capital of the northern Faryab province. That was shocking enough and par for the course in a country riven with sectarian and tribal animosities. It was on hearing the news that two British soldiers had been shot dead in Afghanistan that I decided that enough was enough.

The killings forced me to look again at my earlier support (hopefully not uncritical) for the Nato-led operations in that benighted country. Suddenly I had to re-examine the thoughts of the man who had been able to write with glad confidence in this newspaper back in 2008: "Afghanistan is not yet a lost cause; it is an unwon cause." Well, that's no longer true. As far as our country and its armed forces are concerned Afghanistan has now slumped down the ratings to become a lost cause, one which cannot be supported or indeed tolerated.

It wasn't just the killings that tipped the balance because there was nothing new in what happened last week. To use Rudyard Kipling's memorable phrase from his poem Arithmetic On The Frontier, death to a "ten-rupee jezail" has been a regular if fitful occurrence ever since Western boots arrived in the country 10 years ago – and longer if we count the equally ham-fisted interventions during the Victorian period. So far in this century there have been 435 British casualties and more will follow until we finally pull out in 2014. But something changed utterly in this latest affray which saw the deaths of Corporal David O'Connor, a Royal Marine commando, and Corporal Channing Day, a military medic and the third female British soldier to have lost her life in Helmand's killing grounds.

Later it became clear that this was no ordinary or clear-cut incident but a confused fire-fight in which a steady accretion of mistakes led to unnecessary deaths. O'Connor and Day were part of a British Army patrol operating in the Nahr-e Saraj district of Helmand province when they saw an Afghan man wearing civilian clothes and carrying a weapon, clearly a potential threat.

At the point of contact he was washing his hands in preparation for prayer – nothing suspicious there – but in the heightened atmosphere that always accompanies a foot patrol in the bad lands of Helmand, the pious Afghan was deemed to be a terrorist and shot dead. In the shocked aftermath as people tried to make sense of what was happening around them, a general stramash broke out and somehow among the confusion O'Connor and Day were gunned down.

That was a tipping point of sorts: a man on the cusp of offering his prayers to God was killed for no other reason than that he looked odd and was in the wrong place at the wrong time. Just as bad, his killing precipitated further violence which claimed the lives of two young British soldiers. The incident probably had more resonance because it happened at the same time that the Poppy Appeal was being launched back at home – the annual commemoration for those who lost their lives in the service of their country.

There had, of course been other portents which combined in intensity and forced me to think again. Not only did I support the operations in Afghanistan, believing them to be the kind of liberal interventionism which would benefit the ordinary people of that country, but I have had the privilege of spending time and working with many of the military units which have served there during the past 10 years. While in the company of these young men and women, it was impossible not be uplifted by the prevailing feeling that they were part of a force for good and that benefits would accrue from their deployment. This was especially true if they were going to Afghanistan in the mentoring role, to train soldiers for the Afghan National Army and policemen for the fledgling internal security forces.

The concept was almost Jesuitical. Give me a young Afghan before he has been contaminated by the Taliban and we will give you an upstanding member of the community who will serve his country as a policeman or soldier. To be fair, the idea did take shape and in many cases it worked, especially in the less warlike of the country's many communities among the so-called Persian tribes from the west of Afghanistan. But in Helmand, the cockpit of much of the violence and the focus of British military interests, the concept was more difficult to implement.

One reason was the prevalence of Pashtunwali, the strict but ethical code of behaviour which binds together the warlike Pashtun people from whom the Taliban draw their main support not just in Afghanistan but also in neighbouring Pakistan. Another reason was the influence wielded by the central government in distant Kabul. A friend who served as a battalion commander (lieutenant-colonel), returned from six months' service in Helmand aghast at how pervasive and injurious that influence was.

At his first "shura" or official meeting with local tribal elders, he was told in no uncertain terms what his hosts thought of the administration led by Hamid Kharzai, a career politician from Kandahar province who is widely held to be corrupt and a US stooge with far too many links into organised crime especially drugs and money-laundering. While it is not unusual for ordinary Joes to be critical of politicians and to view them as self-serving opportunists intent on using their positions to line their own pockets it came as a shock to the colonel to discover that Karzai and his colleagues were viewed as criminals unworthy of support from the Western powers. "Why do you deal with such people?" was a constant refrain.

Well, the fact remains that Karzai was the least worst bet for the West when the US unleashed Operation Enduring Freedom in 2001 – the military enterprise to unseat the resident Taliban government and to create a united front based on the Northern Alliance grouping of friendly tribes. To use the parlance of an earlier piece of covert US diplomacy in Nicaragua, Karzai may have been regarded as a son-of-a-bitch but "at least he's our son of a bitch". In any case, in hastily thought-out regime-change operations of this kind it's not always possible or indeed sensible to be picky about your immediate allies.

So, from the outset the US-led operation in Afghanistan was little more than a road to perdition, leavened only by the hope that as peace returned to the country and democracy was given a chance, things would get better and more amenable politicians would come through the system. And lest this be considered wishful thinking, with a strong dose of hindsight let me say that this was a belief shared by many who had the country's best interests at heart. In some cases it worked too and nowadays things are decidedly better for many ordinary Afghans.

In the same week that the latest killings took place, Nato secretary-general Anders Fogh Rasmussen argued that there are reasons for hope, citing the growing capabilities of the country's armed forces and the fact that the Taliban are being pushed back into country areas well away from urban centres of population. Generally speaking, too, conditions are improving for women, there are more educational facilities and aid projects are beginning to have an impact. In short, where things are working they are working well and standards of living have improved – for many but, alas, not for all.

And therein lies the rub. This business of nation-building has not been carried out in a vacuum. It has taken place against the backdrop of a bloody war which has seen not just military casualties but the unforced deaths of thousands of Afghan civilians, many of whom have been killed as a direct result of military action. In low-intensity wars of this kind these things happen but as Major-General Andrew Mackay, one of our better soldiers, has argued, "the population is the prize".

That was his watchword and he did his best to make sure the message was implemented when he was commanding 52 Brigade in Helmand in 2007. Remembering the Malayan campaign half a century earlier when Britain successfully put down a communist Chinese insurrection in the country, he insisted that the campaign in Afghanistan would only be won when the population came on board and supported it. Try telling that to the family of the unnamed Afghan who met his God sooner than expected while washing his hands.

Or try telling it to the parents of the two corporals who were also killed last week. Like all soldiers, they knew the risks when they joined up and it was revealed that young Channing Day had only ever had that one ambition since entering her secondary school in Northern Ireland. So far the people of Britain have been supportive of the country's military involvement in Afghanistan and have remained stoical about the steady stream of casualties. That's as fair an indication as any that the campaign has not yet become toxic and that most civilians are resisting the temptation to argue for an early exit strategy.

They have a point and their argument goes like this. We owe it to the many service personnel who have died in the conflict, or have been maimed physically or mentally, to stick it out and to ensure that their efforts were not in vain. That's as fine as it goes but unfortunately it doesn't go very far. Governments can only wage wars if the armed forces are prepared to carry out the policy without question and both parties can only maintain the illusion while they retain the support of the country. Take that away and soldiers start worrying that they are not valued and that in the greater scheme of things their efforts and sacrifices have not been worthwhile. At the same time politicians start looking over their shoulders and worrying about votes in their constituencies.

One other factor intrudes – the will and motivation of the people of Afghanistan. A majority of them asked for Western intervention to oust the unwelcome and generally detested Taliban government, but did they ask for a conflict that would last longer than the Second World War and shows no sign of ending? Probably not – in the same way that the people of Iraq were not too unhappy when the last forces pulled out of their country a couple of years ago, leaving their own fate in their own hands.

That's the problem with sticking your nose into other people's affairs. They might welcome it initially but with familiarity comes contempt and that disdain soon turns into something much more robust and challenging. Forced regime change came into its own as a policy at the time of the invasions of Iraq and Afghanistan. In the former country it was always wrong because it was illegal. In the latter country it was never going to work because it was too impersonal, too illogical and too wretchedly planned.

Last week, the Commons International Development Committee said the UK might have to recognise that creating a viable state in Afghanistan is not achievable.

I mourn the unnecessary loss of blood and treasure in Afghanistan but it now has to be said that the intervention was wrong-headed, will achieve little and has to end sooner than later. Civilised countries don't kill people going about their religious obligations – be it in a mosque in a dusty northern Afghan town or in an alleyway near some disputed barricade.