By Valentyn Ogirenko and Aziz El Yaakoubi
KYIV/RIYADH (Reuters) -Russia and Ukraine carried out an unexpected prisoner swap on Wednesday, the largest since the war began and involving almost 300 people, including 10 foreigners and the commanders who led a prolonged Ukrainian defence of Mariupol earlier this year.
The foreigners released included two Britons and a Moroccan who had been sentenced to death in June after being captured fighting for Ukraine. Also freed were three other Britons, two Americans, a Croatian, and a Swedish national.
The timing and magnitude of the swap came as a surprise, given Russian President Vladimir Putin had announced a partial troop mobilisation earlier in the day in an apparent escalation of the conflict that began in February. Pro-Russian separatists had also said last month that the Mariupol commanders would go on trial.
President Volodymyr Zelenskiy said the swap - which involved help from Turkey and Saudi Arabia - had been under preparation for quite a long time and involved intense haggling. Under the terms of the deal, 215 Ukrainians - most of whom were captured after the fall of Mariupol - were released.
In exchange, Ukraine sent back 55 Russians and pro-Moscow Ukrainians and Viktor Medvedchuk, the leader of a banned pro-Russian party who was facing treason charges.
"This is clearly a victory for our country, for our entire society. And the main thing is that 215 families can see their loved ones safe and at home," Zelenskiy said in a video address.
"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."
Zelenskiy thanked Turkish President Tayyip Erdogan for his help and said five senior Ukrainian commanders would remain in Turkey until the end of the war.
Kyiv had a long and difficult fight to secure the release of the five, he said.
They include Lieutenant Colonel Denys Prokopenko, commander of the Azov battalion that did much of the fighting, and his deputy, Svyatoslav Palamar. Also freed was Serhiy Volynsky, the commander of the 36th Marine Brigade.
The three men had helped lead a dogged weeks-long resistance from the bunkers and tunnels below Mariupol's giant steel works before they and hundreds of Azov fighters surrendered in May to Russian-backed forces.
"We're proud of what you've done for our nation, proud of each and every one of you," Zelenskiy said in a video call with the five which was released by his office.
There was no immediate comment from Moscow about the deal and why it had freed men who Russian-backed separatists said would go on trial later this year.
Saudi Arabia brokered an arrangement whereby the 10 foreigners were flown to Saudi Arabia. The mediation involved Saudi Crown Prince Mohammed bin Salman, who has maintained close ties with Putin.
The freed prisoners included U.S. citizens Alexander Drueke, 39, and Andy Huynh, 27, both from Alabama, who were captured in June while fighting in eastern Ukraine.
Also freed were Britons Aiden Aslin and Shaun Pinner and Moroccan Brahim Saadoun, who were all sentenced to death by a court in the self-proclaimed Donetsk People's Republic.
Large numbers of foreigners have travelled to Ukraine to fight since Russia's Feb. 24 invasion.
The head of the U.N. human rights mission in Ukraine said earlier this month that Russia was not allowing access to prisoners of war, adding that the U.N. had evidence that some had been subjected to torture and ill-treatment that could amount to war crimes.
Russia denies torture or other forms of maltreatment of POWs.
(Reporting by Valentyn Ogirenko in Kyiv, Aziz El Yaakoubi in Riyadh and David Ljunggren in OttawaEditing by Rosalba O'Brien)