JERUSALEM Israel and the Gaza Strip's Islamist Hamas rulers prepared to implement a prisoner swap on Tuesday in which Israeli soldier Gilad Shalit will be exchanged for hundreds of Palestinians.
The deal was given the all-clear by Israel's highest court late on Monday after it rejected petitions to block the swap by relatives of Israelis killed by some of the Palestinians to be released.
The first phase of the exchange was expected to begin on Tuesday at around 0400 GMT (6 a.m. local time) and should end a saga that has gripped Israelis over the five-plus years of Shalit's captivity in Gaza.
Egypt, which has been credited as a major player in brokering the deal, will receive Shalit from his Hamas captors and hand him over to Israel at the same time as Israel starts to free the Palestinians at various locations.
Shalit, now 25, was captured in June 2006 by militants who tunnelled into Israel from the Gaza Strip and surprised his tank crew, killing two of his comrades.
After his return, Shalit will be flown by helicopter to an air base in the centre of Israel where he will be greeted by Prime Minister Benjamin Netanyahu, other leaders and close family. Later he will be flown to his home in northern Israel.
Hamas were readying a heroes' welcome in Gaza for 295 of the 477 prisoners set for freedom in the first phase who were due to be sent to the Israeli-blockaded territory. Of those going to Gaza, 41 will then be exiled abroad.
Hamas sources said Turkey, Qatar and Syria will take the exiled prisoners after the movement's leader, Khaled Meshaal, greets them in Cairo.
A group of prisoners will be taken from Israel to the occupied West Bank, where they will be welcomed by Palestinian President Mahmoud Abbas, Hamas's greatest political rival, and their families.
Palestinians regard those jailed by Israel as prisoners of war in their struggle for statehood. Israel has some 6,000 Palestinian prisoners.
Israel withdrew troops and settlers from Gaza in 2005 but tightened its blockade of the coastal strip after Shalit's capture.
The repatriation of captured soldiers, alive or dead, has long been an emotionally charged issue for Israelis, many of whom have served in the military as conscripts. They also feel stung by the high price they feel Israel is paying for Shalit.
The campaign to free Shalit has often made Israeli headlines and the media in Israel has focussed on little else since Netanyahu declared a week ago that he had secured his freedom.
In Gaza, the deal was trumpeted as a triumph for Hamas. The centre of Gaza city was festooned with giant posters bearing portraits of the prisoners. The day has been declared a national holiday and a mass rally planned.
In the second phase of the swap expected to take place in about two months, a further 550 Palestinian prisoners will be freed, officials said.
Palestinian Prisoners Affairs Minister Essa Quraqe said that inmates not being released had ended a hunger strike as part of the deal after Israel agreed to return their conditions to what they were prior to Shalit's abduction.
The Israel-Hamas deal seemed unconnected to the U.S. State Department saying on Monday that the so-called Quartet of Middle East mediators would meet Israeli and Palestinian officials on Oct. 26 to try to lay ground for fresh peace talks.
Israeli-Palestinian negotiations collapsed 13 months ago in a dispute over settlement building in the West Bank.
Abbas, dismissed by Hamas for what it sees as a feeble stance, has been pursuing a bid for U.N. recognition of Palestinian statehood in the West Bank and Gaza Strip in the absence of negotiations with Israel.
(Additional reporting by Nidal al-Mughrabi and Douglas Hamilton in Gaza and Tom Perry in Ramallah; Editing by Louise Ireland)