Five Britons are among almost 300 people released in a prisoner swap between Russia and Ukraine overnight.
Three of them have been identified as Aiden Aslin, John Harding and Shaun Pinner, who were captured by Russian-backed separatists in eastern Ukraine in April.
In a personal message recorded on their flight home, Mr Aslin and Mr Pinner thanked those who had worked to free them.
“We’re now out of the danger zone and on our way home to our families,” said Mr Aslin.
“By the skin of our teeth,” Mr Pinner added.
Mr Aslin continued: “We just want everyone to know the good news. Thanks to everyone who has been supportive. It’s really appreciated.”
Most of those released are Ukrainian, many of them from the Azov regiment, which became famous for its stubborn defence of the south-eastern city of Mariupol.
For months the small band of soldiers, including John Harding, along with some civilians, were holed up in the Azovstal steelworks, with very little food, medicine, ammunition, or electricity.
They eventually surrendered in May.
As well as the Britons, the 10 foreigners released include Moroccan Brahim Saadoun, Americans Alexander Drueke and Andy Huynh, a Croatian, and a Swedish national.
They were taken to Saudi Arabia, while many of the Ukrainians were taken back to Ukraine.
The prisoner swap was brokered with help from Turkey and Saudi Arabia’s Crown Prince Mohammed bin Salman, who has close ties with Russian President Vladimir Putin.
It appeared to be a surprise to many, coming as Mr Putin raised the stakes in the war by threatening to use nuclear weapons.
Ukraine’s president Volodymyr Zelenskyy said: “We remember all our people and try to save every Ukrainian.
“This is the meaning of Ukraine, our essence, this is what distinguishes us from the enemy.”
Mr Zelenskyy said the most difficult negotiations had been around the release of five senior Ukrainian commanders, including Lieutenant Colonel Denys Prokopenko, commander of the Azov battalion, his deputy Svyatoslav Palamar, and Serhiy Volynsky, the commander of the 36th Marine Brigade.
The three were the leaders of the resistance at Mariupol and now they, and the other two who have not been named, will remain in Turkey until the end of the war, Mr Zelenskyy said.
As part of the deal, Ukraine sent back 55 Russians and pro-Moscow Ukrainians, including Viktor Medvedchuk, the leader of a banned pro-Russian party who was facing treason charges.
Mr Medvedchuk counts Mr Putin as a close friend – so close that he chose the Russian leader to be godfather to one of his daughters.