APART from the Union Flag flying upside down in the breeze at Andrews air force base in Washington, everything seemed to be going according to plan last week when President Barack Obama welcomed Prime Minister David Cameron.

It was going to be a demanding three days with business as well as pleasure on the agenda, and above all both sides were hailing it as the latest manifestation of the much vaunted "special relationship" – the tie binding the US and the UK which has its origins in the second world war. Both leaders had a lot of catching up to do and both had to find common ground to deal with Afghanistan, the foreign policy millstone which hangs round both of their necks.

But as the summit began they also had to deal with a string of bad news stories coming out of Afghanistan, culminating in President Hamid Karzai's unexpected announcement last Thursday that in future Western forces would only be permitted to operate out of major bases and that he wanted the drawdown of Nato troops to begin in 2013, a year earlier than anticipated. The president's demand was later played down by his officials as "nothing new", but so far it has not been retracted. All of a sudden, as Obama and Cameron began their glad-handing, it seemed as if their policies in that troubled country were imploding and that Afghanistan had become mission impossible,

It was all supposed to be so different. In the days leading up to the summit the briefing from the White House was that the meeting would finally bury the subject of neo-conservatism, the flawed US foreign policy from the Bush years which had plunged both countries into unnecessary wars in Iraq and Afghanistan. In that sense, too, it would also distance Cameron from former prime minister Tony Blair and signal a new start in the transatlantic partnership. And to cap it all there would also be a boys' night out at a ball game in Dayton, Ohio.

The word from Downing Street was that this was about the strength of the "special relationship" and the fact that "Barack and Dave" were going to have a private discussion on "hot-button" issues. Or, as the president said in his speech of welcome, he was "chuffed to bits" that his friend was in town and couldn't wait for their "natter" in the Oval Office.

To be fair to the White House team behind the summit, on a personal level it all went swimmingly. Both leaders seemed comfortable in each other's company, there was a sumptuous White House dinner with a seasonal menu and A-list guests, the speeches were mutually congratulatory and there was the added bonus of a short flight in Air Force One, the preferred presidential mode of luxury air travel. However, there is always a blip in any diplomatic gathering and the US marines who hoisted the Union Flag upside down – a traditional distress symbol – perhaps knew more about events than they were prepared to admit.

Even before the British party left the UK, they knew Afghanistan would dominate the agenda. Not only is it the longstanding glue which helps hold together the transatlantic partnership, but both leaders have recently had to endure military setbacks which have led to calls for a radical change in their countries' policies.

Two weeks ago, six British soldiers died in a Taliban bomb attack in Helmand that brought the overall British death toll in the country to 404. The attack sparked fresh calls for the British presence to be withdrawn ahead of the present 2014 deadline.

Bad as that was for Cameron, his host was under even more pressure. US forces in Afghanistan were dealing with a US soldier accused of going berserk and shooting 16 Afghan civilians in Kandahar province. Yesterday, he was named as Staff Sergeant Robert Bales, 36, a father of two from Washington state who was described as a decorated combat veteran with an exemplary service record. The suspect has been returned to a military detention centre at Fort Leavenworth in Kansas and will undergo what is being described as "due process of US military law" but inevitably the incident has soured the already tense relationship between Kabul and Washington.

Last month, Obama was forced to apologise after it was revealed that US security forces had "accidentally" incinerated copies of the Koran, an outrage that led to the retaliatory shooting of four US servicemen. Coming on top of an earlier incident in which a video was released on YouTube showing US marines urinating on the corpses of Taliban fighters it is not difficult to understand why the US deployment in Afghanistan is in deep trouble – and in danger of falling apart.

At the end of last week, Karzai dropped the bombshell that in future he would prefer US forces only to operate near their own bases and to stay clear of Afghan villages. As the demand was made directly to the US Defence Secretary, Leon Panetta, during an official visit to Afghanistan on Thursday, it was clearly not a reflex response to the shootings but a measured criticism of US policy.

It took the Pentagon by surprise and sent alarm bells ringing in the US command structure in the country. US and Nato thinking on the exit strategy is predicated on training and mentoring the Afghan security forces which will start taking over policing of the country next year. Without the capacity to operate in rural areas there will be fewer chances for Western personnel to work with their Afghan counterparts. As a British army commander told the Sunday Herald, it is also a slap in the face for Nato forces and everything they have tried to achieve.

"We have expended a great deal of lives and treasure in forging a policy which we feel is the way forward for Afghanistan," he said. "It's all based on mutual trust and however trying the circumstances it is working. All that will disappear if we can't look our colleagues directly in the eye."

MORE followed. The day after the meeting with Panetta, Karzai lambasted the US for its handling of the case of Sgt Bales, the soldier alleged to have carried out the killings. There have also been widely believed rumours that he did not act alone, leading to suggestions there might have been a cover-up by the US army. Despite requests for Bales to face trial in Afghanistan he has been shipped back to the US, a decision which Karzai deplores.

"This has been going on for too long," he said last Friday. "This is by all means the end of the rope here. This form of activity, this behaviour, cannot be tolerated. It's past, past, past the time."

With the US-Afghanistan relationship already under strain there is a sense of deepening crisis. At the same time that Karzai was making his feelings clear to the US defence secretary, the Taliban announced it is no longer interested in maintaining a dialogue over Afghanistan's future as it has no belief in US good faith.

This was not the outcome Obama and Cameron wanted and it leaves both leaders with a sense of unfinished business ahead. Cameron, too, has issues with the British position in Afghanistan. Not only is the operation becoming increasingly unpopular as a result of the spike in military casualties, but it is also becoming increasingly unaffordable. The most recent cost of the deployment in Afghanistan has been put at £18 billion by the Commons Select Defence Committee. There has also been an increase in requests for voluntary redundancy from personnel disillusioned with current conditions and the threat of more cuts ahead. The Prime Minister gave an indication of his determination to hasten the timetable for withdrawal when he said in Washington that "we are now in the final phases of our military mission".

Before the presidential summit, diplomats in Washington and London had warned that while Afghanistan would be a major issue of discussion, other foreign policy matters such as Syria would be a no-go area. This has proved to be a thorny issue, largely due to Russian and Chinese intransigence in the UN Security Council but also because the other members cannot find a mutually compatible solution to the government-inspired violence in Syria. Obama faced a similar impasse over Libya last year and with an election later this year he is certainly not minded to embark on further foreign adventures.

By a perverse accident of diplomacy, in demanding a hastier withdrawal, President Karzai presented Obama with a strategy which under other circumstances he might have been willing to accept as a means of extricating the US from this longrunning and increasingly unwinnable war.

Confining Nato personnel to agreed operational areas will hasten the departure of Western troops by forcing them to bring forward the timetable for drawdown. It may also reduce casualties on both sides.

But it will come at a price. Unless the final months of deployment are spent completing the training of Afghan forces, the whole Western counter-insurgency policy will collapse. And that will make it impossible to complete the job with an outcome that suits all sides.