Media playback is unsupported on your device Media caption The union flag was lowered at Camp Bastion, as Ben Brown reports

The last UK base in Afghanistan has been handed over to the control of Afghan security forces, ending British combat operations in the country.

The union flag was lowered at Camp Bastion, while Camp Leatherneck - the adjoining US base - was also handed over to Afghan control.

Prime Minister David Cameron said Britain would never forget those who had died serving their country.

The number of deaths of British troops throughout the conflict stands at 453.

The death toll among US military personnel stands at 2,349.

Mr Cameron tweeted: "I made a commitment that I would get our Armed Forces out of Afghanistan by 2015 and today sees the end of combat operations in the country.

"We will always remember the courage of those who served in Afghanistan on our behalf and never forget those who made the ultimate sacrifice."

'Courage and commitment'

A spokesman for the Afghan Defence Ministry welcomed the handover, which he said "puts our capabilities into practice".

"Afghan security forces have been leading the fight in ground operations in the country for two years now."

Image copyright MOD Image caption The UK and US flags have been lowered at Camp Bastion and Camp Leatherneck

Image copyright MOD Image caption As UK combat operations end, Afghan security forces will take an increased role

Image copyright Reuters Image caption US, UK and Afghan military personnel attended the handover ceremony

The UK forces were part of a US-led coalition which toppled the ruling Taliban in 2001, following the 9/11 attacks in the US.

After 9/11, US President George Bush had demanded that the Taliban hand over any leaders of al-Qaeda - the militant group which later claimed responsibility for the attacks - in Afghanistan, but the Taliban did not immediately comply.

Taliban leaders called for talks, but US President George Bush said there would be "no negotiations" and military action started on 7 October.

Camp Bastion, in Helmand province, has been the UK troops' main Afghan base since 2006. At the time it opened, the UK said its forces would be there to protect reconstruction of the country, but they got caught up in the struggle against the Taliban - which continues to fight and has carried out attacks in recent weeks.

Helmand's Provincial Governor Naim Baluch said British forces and their allies had improved security and Afghanistan was grateful for their "courage and commitment".

He said Afghans were now "ready to deliver security ourselves".

Democratic transition

Responding to the handover, Labour party leader Ed Miliband said: "All those who served did so to help ensure Afghanistan could no longer be used as a safe haven for terrorists."

He added that Britain "must make sure that we continue to give the right support to the Afghan government both politically and through humanitarian aid, so that security and stability in Afghanistan can be maintained in the years to come".

Defence Secretary Michael Fallon said UK support would continue through "institutional development", the Afghan National Army Officer Academy and development aid.

Media playback is unsupported on your device Media caption Michael Fallon tells Andrew Marr that "mistakes were made" in Afghanistan operation

Speaking on the BBC's Andrew Marr Show, Mr Fallon accepted the Taliban had not been defeated, but said Afghan forces were now taking "full responsibilities".

He said: "Our armed forces' tremendous sacrifice laid the foundations for a strong Afghan security force, set the security context that enabled the first democratic transition of power in the country's history, and stopped it being a launch pad for terrorist attacks in the UK."

'No return'

Asked about UK military operations, Mr Fallon said: "Mistakes were made militarily, mistakes were made by the politicians at the time and this goes back 10, 13 years.

"Clearly the numbers weren't there at the beginning, the equipment wasn't quite good enough at the beginning and we've learnt an awful lot from the campaign.

"But don't let's ignore what has been achieved."

Mr Fallon said most of the UK forces would be home by Christmas, with a few hundred staying to help with training at the officer academy.

"We're not going to send combat troops back into Afghanistan, under any circumstances," he added.

At the scene

Image copyright MOD

Jonathan Beale, BBC defence correspondent, Camp Bastion

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.

Read more from Jonathan Beale.

The UK's command of Helmand was transferred to US forces in April and personnel, military vehicles and kit have been returning home in recent months.

At the height of the war in 2009, about 10,000 UK troops were based at Camp Bastion and the UK's 137 patrol bases in southern Afghanistan.

UK troops in Afghanistan 140,000 UK troops served £21.5bn Total operational cost 453 UK troops killed

108 died in 2009 - the worst year

470 mentors staying on MOD

Professor Malcolm Chalmers, of defence think tank the Royal United Services Institute, warned that the Taliban was still "a very capable organisation".

"What we have to do to prevent the country slipping back is support the Afghan state - the civilian side, making sure that teachers and doctors and nurses are paid, but also critically the armed forces," he said.

"The Afghan army has come a long way in the last few years but they're still dependent on foreign money to pay their wages and right now there's a question mark over how long that will continue."

Media playback is unsupported on your device Media caption Camp Bastion was once a huge, bustling base, as Jonathan Beale reports

Sir William Patey, former UK ambassador to Afghanistan, said the UK must keep its promise to financially support the Afghan government.

"If we renege on that commitment and lose interest because the troops have gone, that will be a betrayal of what we've said we will do for the Afghan state and the Afghan people," he said.

Lord Dannatt, former head of the Army, said the conflict had been "difficult and expensive in blood and treasure" for the UK, but Afghanistan now had a "chance of a decent future".

Image copyright MOD Image caption With the UK and US handing over their bases, the Afghan flag will fly alone

Image copyright MOD Image caption British troops have been in Afghanistan since 2001, and 453 have died

Image copyright PA Image caption Michael Fallon said UK troops would not return to fight in Afghanistan "under any circumstances"

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.

But he said politicians in 2001 had not known what they wanted to achieve, the military had not had enough resources and there had been no "coherent military plan".