Israeli soldier Gilad Shalit has returned home after five years' captivity, as hundreds of Palestinian prisoners exchanged for him were greeted in scenes of joy and celebration in the Gaza Strip and the West Bank.
The exchange was part of a prisoner-swap agreement between the Palestinian militant group Hamas and Israel.
Under the deal, Israel is to release more than 1,000 Palestinian prisoners for Shalit, 25, held in the Hamas-controlled Gaza Strip since June 2006.
Shalit was handed over to Egyptian officials at the Rafah border crossing between Gaza and Egypt, and was then taken by Israeli officials to the Tel Nof air base, where he was reunited with his family and greeted by Prime Minister Binyamin Netanyahu.
In an interview with Egyptian television shortly after his release, Shalit looked tired and dazed. He expressed hope that the prisoner swap would promote peace between Israel and the Palestinians.
The Israeli army said that according to an initial medical examination at the border, Shalit is in "good and satisfactory condition."
"Shalit was transferred to the care of the representatives of the IDF Personnel Directorate and has undergone an initial medical examination by medical personnel," Israeli Defense Forces (IDF) spokeswoman Avital Leibovich said.
"They confirmed that he is in stable health. Sergeant First Class Shalit then spoke to his family over the phone. The IDF welcomes home Gilad Shalit."
Netanyahu hailed the return of Shalit, but acknowledged the exchange deal was difficult for Israelis to accept.
"This is also a hard day. Because even if the price has been reduced, it is still heavy." He said Israel would continue to fight terror. "Every released terrorist who returns to terror, will be taking his life in his hands."
Palestinians Welcome Freed Prisoners
Meanwhile, Israel freed 477 Palestinian prisoners, most of them to the Gaza Strip city of Rafah, where Hamas leaders and crowds greeted the former prisoners piling off buses.
In the West Bank, there were also scenes of jubilation with thousands of people welcoming former detainees home, waving Palestinian flags and cheering as they got off buses outside the presidential compound.
Addressing the crowd, Palestinian Authority President Mahmud Abbas said: "Your sacrifices and your efforts and your work has not been in vain. You have sacrificed and fought."
At the Palestinian Burj al-Barajneh refugee camp in Lebanon, Hamas spokesman Raafat Morra called the prisoner exchange a "victory" for the Palestinian resistance.
"Today is a victory for the resistance and a victory for steadfastness. We in the Hamas movement are proud today because we broke all of the Israeli taboos," he said. "We were able to force Israel to accept all the conditions that we announced from the moment when soldier Gilad Shalit was captured."
The 40 prisoners who are to be sent overseas will remain in Egypt before being sent to host countries, including Turkey, Syria, and Qatar.
Earlier, convoys of Palestinian prisoners left jails in Israel under heavy security, heading to the West Bank and the Egypt-Gaza border.
Television showed footage of dozens of families of Palestinian prisoners at the Egyptian border, chanting, cheering, and waving Palestinian flags.
Mona Kafisha was there, awaiting the release of her three sons.
"Ayman [was sentenced to] 35 years and he has served 15, Alaa was sentenced to 30 years and has served eight of them, and Lu'ay [was sentenced to] 19 years and he has served 10 of them. They will be sent to Gaza," she said.
"We are happy that we will see them but because the [border] crossing is closed, we are afraid that they will enter and we will stay here, making us fear that we won't be able to welcome them."
Under the swap deal reached between Hamas and the Israeli government last week and brokered by Egypt, the remaining 550 are scheduled to be released within two months.
Hamas spokesman Sami Abu Zuhri called the point that the prisoners left their jails "a historic moment."
Israel has some 6,000 Palestinian prisoners.
Shalit Comes Home
Emotions were also running high across Israel, where on October 17 the Supreme Court rejected petitions by relatives of victims of militant attacks to delay the swap.
In a letter to bereaved Israeli families, Prime Minister Binyamin Netanyahu wrote, "I understand the difficulty in accepting that the vile people who committed the heinous crimes against your loved ones will not pay the full price they deserve."
His spokesman, Mark Regev, added: "We, of course, don't want to do anything that would play into the hands of terrorists, that would make terrorists more powerful, that would endanger Israeli civilians in future terrorist operations. And it was very difficult negotiations with Hamas.
"In the end, I think we have safeguards in this arrangement which contain the risk that it is involved in such a release [of Palestinian prisoners]."
White House spokesman Jay Carney said President Barack Obama was "personally pleased" by the development and urged Israelis and Palestinians to take steps toward resuming peace negotiations.
United Nations Secretary-General Ban Ki-moon and British Prime Minister David Cameron expressed hope that the prisoner exchange would bring peace in the region a step closer.
"I am very encouraged by the prisoner exchange today after many, many years of negotiations," Ban said. "The United Nations has been calling [for ending] this unacceptable detention of Gilad Shalit and also the release of all Palestinian prisoners whose human rights have been abused all the time."
In Tehran, Iranian Foreign Ministry spokesman Ramin Mehmanparast congratulated the Palestinians on the release of their prisoners.
Shalit was expected to return with his family to his northern hometown of Mitzpe Hila.
Shalit was a 19-year-old corporal on duty along the Gaza border when he was captured on June 25, 2006, by militants from three Gaza-based militant groups, including Hamas.
Three days after, Israel launched a massive military operation against Gaza in a bid to secure his release, which lasted five months and left more than 400 Palestinians dead.
Opinion polls in Israel suggest a strong majority of Israelis supports the deal.
The last swap for an Israeli soldier or the remains of an Israeli soldier came in 2008, when five militants were released in a deal with Hizbullah in exchange for the bodies of two Israelis.
Another deal four years earlier saw hundreds of Palestinians returned for one former Israeli officer and the bodies of three Israeli soldiers.
compiled from agency reports