David Cameron in Afghanistan at 'end of an era'

David Cameron shakes hands with a British soldier at Camp Bastion

There are 2,700 British troops left in Afghanistan - most of them here at Camp Bastion - and hundreds of them gathered round the prime minister to hear him thank them one last time before they leave at the end of the year.

Camp Bastion was once a huge military city in the desert, a headquarters the size of Reading that served 137 British bases across Helmand.

Now it is the only base left, a fraction of its former self and in a few weeks will be closed for good.

When Tony Blair first came here in 2006, he said the fate of the world's security would be decided in this extraordinary piece of desert.

But he was wrong.

High price

For while this campaign is ending, David Cameron is acutely aware that he is beginning another, in another desert in Iraq.

So it is no surprise that the prime minister is being cautious.

He refuses inducements to say it is mission accomplished.

Instead he notes that Britain has paid a high price for its engagement in Afghanistan and talks of the vital work that had been done to rid the country of al-Qaeda and build up its army.

"We have gone a long way to achieve that," he says.

The one small glimmer of hope comes in the shape of the new government.

Image caption New Afghan President Ashraf Ghani said his government must "deliver" or "collapse"

Mr Cameron flew to Kabul to meet Ashraf Ghani, the new Afghan president who was sworn in this week after months of political uncertainty.

The successor to President Karzai has struck a deal with the Americans to help with security once Nato troops leave.

He is open to engaging with the Taliban but he is frank about the challenges he faces.

'No return'

I asked him if he really was going to end corruption, make government function and build up the army and police and he replied: "We have to deliver. Either we deliver or we collapse. There is no alternative."

Local British commanders told me the Afghan army was more than capable of maintaining security by itself and would cope when Nato combat troops leave at the end of December.

I asked the prime minister, if Afghanistan did collapse, would British combat troops ever return?

His reply left no room for doubt: "We are not going to send combat troops back to Afghanistan because we have trained up an effective Afghan army and Afghan national police force."

Image caption Tony Blair met troops at Camp Bastion in 2006

So a military campaign in Afghanistan that has dominated and shaped British politics is coming to an end.

The fight against terror has moved to a different battle ground.

It was not too long ago that I used to go on prime ministerial trips to visit British troops in Baghdad and Basra.

But David Cameron insists that simply isn't going to happen.

For for 13 long years British prime ministers have been coming to Afghanistan to meet the troops they have sent to fight and the politicians they hope to support.

But that era is coming to an end.

For this is David Cameron's ninth visit here as prime minister and almost certainly his last before the election.

More on this story