Russia freed Ukrainian pilot Nadezhda Savchenko on Wednesday after holding her for nearly two years, with President Vladimir Putin pardoning her as part of a swap for two Russian servicemen jailed in Ukraine.

The Ukrainian president sent his plane to pick up Savchenko in Rostov-on-Don in southern Russia and bring her home to Kiev, where she received a hero's welcome.

"Thank you everyone for fighting for me!" she told a scrum of journalists at Kiev's Borispol Airport. "You fought for everyone behind bars. Politicians would have kept silent if people had been silent. I would like to say thank you to everyone who wished me well: I have survived because of you."

The two Russians were also freed on Wednesday, and Russian state television showed them being greeted at a Moscow airport by their wives.

Savchenko was captured by Russia-backed rebels in eastern Ukraine in 2014 and sentenced in March to 22 years in prison for her alleged role in the deaths of two Russian journalists in the conflict zone. Her refusal to bend after nearly two years in Russian custody has made her a national hero in Ukraine.

The two Russians, Alexander Alexandrov and Yevgeny Yerofeyev, were captured last year. They acknowledged being Russian officers, but the Russian Defense Ministry claimed they had resigned from active duty. They were tried in a Kiev court, which sentenced them to 14 years in prison after finding them guilty of terrorism and waging war in eastern Ukraine.

Both of the Russians submitted a petition to Ukrainian President Petro Poroshenko for a pardon, Alexandrov's lawyer Valentin Rybin announced Wednesday morning, indicating a swap was imminent.

Savchenko's lawyers have refused to say whether she also filed for a pardon. However, suggesting that she did not, Putin said he decided to pardon her after the relatives of the killed journalists petitioned him to show mercy for Savchenko.

Putin was shown on state television on Wednesday meeting with the widow and sister of the two Russian journalists who were killed in a mortar attack in eastern Ukraine in June 2014.

"I'm not going to go back to that tragedy in which you lost your closed ones," Putin said. "I would like to thank you for your position and express hope that such decisions, driven by humanity, will help to alleviate the stand-off in the conflict zone and help to avoid such terrible and pointless losses."

Savchenko's release came a day after Putin, Poroshenko and the leaders of France and Germany spoke by telephone about ways to settle the conflict in eastern Ukraine. Western leaders had long been calling for Russia to free Savchenko.

Keeping Savchenko in custody clearly had become a liability for the Kremlin. Putin, however, would have looked weak if he had backtracked on her case and could only release her in a swap once she had been convicted. Once her trial and that of the captured Russians had run their course, Putin and Poroshenko made a deal.

Poroshenko announced last month that he and Putin had reached an agreement on the swap, but there had been no confirmation from the Kremlin.