Rebels from the self-proclaimed separatist republics in the Luhansk and Donetsk regions handed over 74 captives, while Ukraine's government delivered 233. Some had been held for more than a year.
Larisa Sargan, a spokeswoman for the Ukrainian prosecutor general's office, said on Facebook that one of the 74 prisoners released by the separatists indicated she would stay in Donetsk.
Carrying their belonging, the prisoners were turned exchanged in the town of Horlivka and the village of Zaitseve, in an area dividing the separatist regions and Ukraine. One held a cat.
"I'm out of hell. I have survived," said Yevhen Chudentsov, who served with one of Ukraine's volunteer battalions in the east and was taken prisoner in February 2015.
Chudentsov said he faced threats and beatings while in rebel custody, and his front teeth were knocked out. He was initially sentenced to capital punishment, which was later changed to 30 years in prison. He said after his release in Horlivka that he would join the Ukrainian military again.
The exchange was supervised by observers from the Organization for Security and Cooperation in Europe, a trans-Atlantic security and rights group that has deployed monitors to eastern Ukraine.
The OSCE welcomed the swap and urged the two sides to build on the momentum from it.
"Allowing such a significant number of people, who have been held on both sides, to return home before the New Year and Orthodox Christmas is a very welcome development," said Austrian Foreign Minister Karin Kneissl, the OSCE chairman. "Today's exchange is not only a humanitarian act but also a helpful step in confidence-building."
Ukraine was supposed to release 306 people, but dozens chose to stay in Ukraine or had been freed earlier, said Viktor Medvedchuk, who monitored the exchange on the Ukrainian side.
Many of the captives were not combatants. Some were activists and bloggers who were charged with spying or treason.
Anatoly Slobodyanik, one of the prisoners traded by Ukraine, said he didn't want to go to the rebel side and would return to his home town of Odessa.
"I'm not guilty of anything and I don't want to go to the other side," he said.
Ukrainian President Petro Poroshenko praised the Ukrainian prisoners held by the rebels for their endurance.
"I'm grateful to all those who remained loyal to Ukraine in those unbearable conditions," Poroshenko said while greeting the free captives. "They have shown their adherence to the principles of freedom and independence."
The Ukrainian leader also hailed German Chancellor Angela Merkel and French President Emmanuel Macron for helping organize the exchange.
Merkel and Macron welcomed the swap, saying in a joint statement that they "encourage the parties to the conflict also to enable the exchange of the remaining prisoners, grant the International Committee of the Red Cross full access and support the ICRC's search for missing people."
The simmering conflict between the separatists and government troops in eastern Ukraine has killed more than 10,000 people since 2014.
The 2015 deal brokered by France and Germany and signed in Minsk, the Belarusian capital, envisioned a prisoner exchange, but the two sides argued continuously over lists of captives and only a few dozen had been traded prior to Wednesday. Separatist leaders and a Ukrainian government representative finally agreed to the exchange last week, with the head of the Russian Orthodox Church acting as mediator.
Merkel and Macron emphasized that the exchange and a recommitment to a comprehensive cease-fire "should also serve to build up confidence between the parties to the conflict, also with a view to the full implementation of the Minsk agreements."
Associated Press writers Geir Moulson in Berlin, Yuras Karmanau in Minsk, Belarus, and Nataliya Vasilyeva and Vladimir Isachenkov in Moscow contributed to this report.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.