I ONCE spent three months hiding in the Hindu Kush mountains with Afghan guerrilla fighters combating the Soviets.

It was one of the longest continual stints I spent with the mujahideen during their decade of resistance against the Red Army in the 1980s.

Exhausted and desperate to get out, I recall asking the commander of the group - who later became the governor of Herat Province - when he could arrange to smuggle me back over the border into Pakistan from where I could begin my journey home.

"You foreigners should know by now that getting into Afghanistan is one thing, but getting out is always that much more difficult," he replied with a mischievous grin.

His name was Sayed Hussein Anwari. He had been a schoolteacher in Kabul before taking up arms against the Soviets. Later he would fight with the Northern Alliance, ousting the Taliban from power before becoming a government minister.

It's been a couple of years since Anwari and I last met but I often wonder what he would make of Afghanistan's fortunes today and what the future might hold for his country.

Certainly he was right about one thing, Afghanistan is never an easy country for foreigners to extricate themselves from once they become embroiled.

US President Barack Obama knows this all too well, having recently felt the need to authorise a more expansive mission for the military in Afghanistan in 2015 than originally planned. That move will ensure American troops will have a direct role in fighting there for at least another year.

Yesterday, there was yet another stark reminder of the potent threat posed by the Taliban and other insurgents when a suicide bomber hit a UK embassy vehicle in the Afghan capital Kabul, killing five people including one Briton. The blast in the east of the city also wounded 33 people, including many bystanders.

This, of course, is only the latest in a wave of attacks in a deteriorating security situation in Afghanistan as most foreign combat troops prepare to withdraw from the country by year's end.

Given the strength of the continuing Taliban threat just what then can we expect of those troops President Obama intends to deploy to bolster the US-led presence?

"New rules" it seems have been drawn up in an order by Mr Obama that clarified the authorities US military commanders will have after the official end of the combat mission in December.

Among these are details of precisely who US commanders can target. According to Pentagon spokesman Rear Admiral John Kirby, US troops would continue targeting some, though not all, Taliban militants.

"We won't target Taliban just merely for the sake of the fact they're Taliban and belligerents," Mr Kirby is on record as saying.

If this sounds like doublespeak then that's because it is, something the Rear Admiral effectively confirmed in his follow-up remarks.

"Should members of the Taliban decide to threaten American troops or specifically target or threaten our Afghan partners in a tactical situation, we're going to reserve the right to take action as needed. If they pose a threat directly to our troops or to the Afghan security forces, certainly then they become fair game at that point."

In other words it's business as usual. Or is it? On closer inspection, Mr Kirby's remarks reveal hints of how two significant developments over the past several months have impacted on American tactical and strategic thinking. The first of these is the resurgence of Islamic militants in Iraq and the second the presence of a new, pro-American government in Afghanistan.

As Andrew Tilghman, a staff writer at the Military Times recently pointed out, many US military chiefs were taken aback by the catastrophic collapse of several Iraqi army divisions earlier this year as jihadists loyal to the Islamic State (IS) group seized large swathes of northern Iraq, including the country's second-largest city Mosul.

This, remember, was the same Iraqi Army Washington had trained up and spent billions of dollars on "improving", yet when faced with the IS offensive simply proved largely unwilling to fight.

This recent experience focused the minds of many US military officials, leading some to reconsider their policies and tactics in Afghanistan.

"People are having second thoughts about their confidence in the ability of host-nation militaries. It's always a risk when your strategy relies on someone else to do the fighting," says Mieke Eoyang, director of the National Security Programme at Third Way, an influential Washington based think-tank.

The other factor influencing American thinking lately about Afghanistan has been the recent election of Ashraf Ghani as president who is far more supportive of US military assistance than his predecessor Hamid Karzai.

Brought into office in September, one of the first things Mr Ghani did was sign a deal with the US to keep American troops in Afghanistan beyond the end of this month. Within that deal Mr Ghani also lifted the ban on controversial night raids by US and Afghan special operations troops, imposed by former President Karzai in 2013. He is, in other words, regarded as a guy with whom the Americans can do business. That much has become apparent through his already close working relationship with General John F. Campbell, the allied commander in Afghanistan.

"The difference is night and day," General Campbell is reported to have said in an email about the distinction between dealing with Mr Ghani and Mr Karzai.

So where does this leave Afghanistan's security in the immediate and longer-term future?

Perhaps the best answer to this is summed up in the argument put forward by my journalist colleague Jack Fairweather in his new book The Good War: Why We Couldn't Win the War or the Peace in Afghanistan.

I totally agree with Mr Fairweather's argument that Afghanistan's fate has always been in Afghan hands. He is right too that the way the West fought in Afghanistan was both ineffective and inefficient. Correct also is his case that from the start the premise that the West could "win" in Afghanistan was flawed and faulty.

I would be the first to admit I didn't always think this way, hoping that in some way by ridding Afghanistan of the al Qaeda-Taliban presence, ordinary Afghans might benefit and have the opportunity to live in peace. But as we now know that was not to be the case and what has ensued has been a complete mismatch of timelines, intentions and expectations.

Tragically, in so many rural parts of the country the activities of the West's military campaign have only served to alienate many ordinary Afghans in much the same way I remember the Soviet occupation doing. In such places, many Afghans have now come to see the Taliban as the lesser of two evils. If one thing is clear it's that the US military presence in the country far from receding, is now experiencing a renewed sense of mission creep.

Given this, it's probably fair to assume we will continue to see an escalation of Taliban strikes like that witnessed in Kabul yesterday.

My old Afghan friend Sayed Anwari was right. We foreigners do find it difficult to get out once inside his country.