The union flag was lowered at Camp Bastion, while Camp Leatherneck – the adjoining US base – was also handed over to Afghan control.
UK troops entered Afghanistan in 2001. Defence Secretary Michael Fallon spoke of his “pride” at the mission’s end.
The number of deaths of British troops throughout the conflict stands at 453.
The last US Marines unit in Afghanistan ended its combat operations with the handover of Camp Leatherneck. The US has lost 2,349 personnel in Afghanistan.
Camp Bastion, in Helmand Province, has been UK troops’ main Afghan base since 2006.
The UK’s command of Helmand was transferred to US forces in April and personnel, military vehicles and kit have begun returning home in recent months.
At the height of the war in 2009, about 10,000 UK troops were based in Camp Bastion and the UK’s 137 patrol bases in southern Afghanistan.
Only a small number of personnel are due to remain in the country after this year, at the British-run military academy in Kabul.
At the scene
The Union flag has been flying in Helmand since 2006.
In a simple ceremony in Bastion – the now mostly empty main base for UK forces – it was lowered for the last time.
The moment was a symbol – for Britain at least – that its war in Afghanistan was over.
US marines alongside British and Afghan soldiers formed a guard of honour, saluting as the national anthems of all three countries were played over a loudspeaker.
It was a US-led ceremony with speeches by American and Afghan commanders.
There was no British voice.
As American marching tunes were piped over the sound system, the Afghan flag stood on its own.
The Afghans will now carry on a fight that’s already claimed the lives of around 4,000 of their security forces this year.
As for the few remaining British troops in Bastion – about 300 – they will be leaving for good soon.
At the time Camp Bastion opened, the government said UK forces would be there to protect reconstruction of the country, but they got caught up in the struggle against the Taliban.
The sprawling base grew to the size of the town of Reading, with a perimeter of 22 miles. Its runway, which at one point became the fifth-busiest UK-operated airstrip, is now expected to handle commercial flights.
Rear Adm Chris Parry, who helped plan the role of UK troops in Afghanistan, told the BBC that Britain’s involvement had been “worth it”, saying the country was now “more stable”, was improving economically and had 40% more children going to school.
“We’ve got rid of al-Qaeda and the bulk of the Taliban from the country,” he said.
“The Afghan security forces are a lot better than most people give them credit for, and most of the people I talk to say that they are well capable of actually holding down most of the major cities and centres of population.”
Chief of the General Staff, Gen Sir Nick Carter, told the Sunday Telegraph the handover of Camp Bastion would be significant “not least because of the sacrifice that so many people have made in Helmand”.
He said: “They are going to have challenges, but I am absolutely confident that the majority of the population in central Helmand will be secured by Afghan forces.” (BBC)
Tina Okunmwendia liked this on Facebook.