Last letters: The moving words of soldiers killed in Afghanistan
"We will always remember the courage of those who served on our behalf."
David Cameron tweeted this message as the last British base, Camp Bastion, was handed over to the Afghan army.
The UK's most senior officer in Helmand, Brigadier Rob Thomson, said Sunday's ceremony marked the "final step in a deliberate, responsible and measured handover" to the Afghans.
Critics questioned whether the current security situation in Afghanistan justified these deaths.
We've been looking at some of the final letters written by troops and made public by their families.
Guardsman Neil Downes
"Please do not be mad at what has happened. I did what I had to do and serving the British Army was it.
"Celebrate my life because I love you and I will see you all again."
Guardsman Neil Downes, 20, left a letter with his father and mother, to be opened in the event of his death.
His mother Sheryl said her son, who was known as Tony, died a hero.
Another letter, sent to his girlfriend Jane, was also made public and included in a book called If You're Reading This... Last Letters from the Front Line, by Sian Price.
Together, the two letters were turned into a song called Letters Home, which was released by an act called The Soldiers.
Guardsman Downes, from Manchester, was on patrol when he was killed, after his vehicle was caught in an explosion in 2007.
Rifleman Cyrus Thatcher
"As I'm writing this letter I can see you all crying and mornin my death but if I could have one wish in an "after life" it would be to stop your crying and continueing your dreams (as I did) because if I were watching only that would brake my heart.
"So dry your tears and put on a brave face for the rest of your friends and family who need you."
Rifleman Cyrus Thatcher, 19, also left a letter at home, for his family to open in case he died.
His parents and brothers said they would "never recover" from his death.
Rifleman Thatcher, from Reading, died in 2009 after an explosion near Gereshk in Helmand province, while he was on patrol.
Pte Christopher Kershaw
"This letter is to inform you of the untimely death of, well, me.
"First of all, I would like to explain that even though I don't know how I died, I'm sure it was from some heroic act and, in the long run, I was doing a job that I loved.
"As I'm sure you are aware, this was my dream job. Even though it had its ups and its downs, I enjoyed every second of it."
Pte Christopher Kershaw's final letter to his father was read out during his funeral in 2012.
The 19-year-old died during his first tour of duty in Afghanistan, when the armoured vehicle he was travelling in was blown up.
"Christopher always was, and always will be, our true hero who fought for our country to keep us safe," said his sister Sarah-Louise, during the funeral service.
We have left these troops' words unedited.