The UK on Saturday flew out the last of its military from Afghanistan, concluding its pullout while leaving hundreds of Afghans eligible for resettlement behind.
The defence ministry tweeted that the "final flight carrying UK Armed Forces personnel has left Kabul", posting photos of drawn and tired-looking soldiers entering a plane.
In a tribute to the troops, the ministry wrote: "To all those who served so bravely under enormous pressure and horrendous conditions to safely evacuate the most vulnerable of civilians: Thank you."
Earlier Saturday, the UK sent out a final plane carrying only civilian evacuees as it wound up its operation to airlift civilians, diplomats and troops ahead of the August 31 deadline agreed with the Taliban for US troop withdrawal.
Prime Minister Boris Johnson thanked those behind the rescue operation, saying they had helped over 15,000 people in less than two weeks.
"I want to thank everyone involved and the thousands of those who served over the last two decades. You can be proud of what you have achieved," Johnson said in a message posted on social media.
Defence Minister Ben Wallace said UK troops had "helped thousands to get to a better future and safety".
- 'Heartbreaking' -
The head of the UK armed forces, General Sir Nick Carter earlier Saturday told the BBC the evacuation operation had "gone as well as it could do" but admitted it was "heartbreaking" that "we haven't been able to bring everybody out".
The armed forces chief estimated the number of eligible Afghans who had not been evacuated as "in the high hundreds".
He stressed that Britain would welcome them if they managed to leave after the deadline, through third countries or other ways.
Defence Secretary Wallace earlier estimated that up to 1,100 Afghans eligible for relocation under the UK's scheme "didn't make it".
Several British nationals waiting outside the airport were among those killed in a bomb attack on Thursday, claimed by the regional Islamic State chapter.
The BBC reported Saturday that a taxi driver from London, Mohammad Niazi, was killed while his wife and two of their children were missing.
Foreign minister Dominic Raab said Friday that two British nationals and the child of another British citizen were killed. It was not clear whether this figure included Niazi.
The last few days will be "a very demanding operation" for the US, Carter said.
"I think our American allies who will effectively be the rearguard as this happens, are going to be very challenged", he said, adding that the threat from Islamic State "has not gone away".
- Controversial animal rescue -
One of the last to leave Kabul was the British head of an animal charity, who flew out on a privately chartered plane along with some 200 cats and dogs from a Kabul shelter, completing a controversial mission that has angered many.
Paul or "Pen" Farthing, founder of Nowzad, mounted a high-profile campaign to evacuate the animals, backed by celebrities including comedian Ricky Gervais.
Nowzad wrote on Facebook: "We are relieved to confirm that Pen and the Nowzad animals left Afghanistan this afternoon and are now safe."
But Farthing's insistence on taking out the animals was widely criticised as hundreds of Afghans eligible to travel to the UK remained behind.
These included Farthing's staff who were unable to reach the front of the line at the airport. The charity said it would "do its utmost to help them".
The Times quoted a UK defence source as saying: "Not only did [Farthing] abandon his Afghan staff but they loaded up their plane with dogs as the US were loading up their 13 dead" from the Thursday attack.
The chair of the House of Commons' Foreign Affairs Select Committee, Tom Tugendhat told LBC radio that an Afghan interpreter who had worked for the UK had asked him: "Why is my 5-year-old worth less than your dog?"