Israelis and Palestinians were waiting with bated breath for the planned release on Tuesday of a first tranche of 477 Palestinian prisoners in return for an end to the more than five year captivity of Israeli soldier Gilad Shalit.
In all, Israel is due to free 1,027 Palestinians under the terms of the hard-won deal for Shalit's freedom, hundreds of them serving life sentences for killing Israelis, in what will be the highest price ever paid by the Jewish state for one person.
If all goes to plan, it will be the first time in 26 years that a captured soldier has been returned to the Jewish state alive.
In Israel, the nation was eagerly awaiting the first images of the now 25-year-old soldier, who has been held incommunicado ever since his capture by three Gaza-based militant groups in a deadly cross-border raid in 2006.
Last week, his family left the Jerusalem protest tent they had been living in for nearly 16 months and returned to their home in Mitzpe Hila in northern Israel to prepare for his homecoming.
Preparations for a big celebrations were also under way across the Palestinian territories to welcome home militants regarded as heroes among their own people.
UN chief Ban Ki-moon hailed the Egyptian-brokered deal between Israel and Gaza's Hamas rulers, who are sworn to enmity.
"The recent announcement of the exchange of prisoners is welcome, it is a positive movement for peace," he said.
A poll released on Monday found that eight out of 10 Israelis backed the deal, with just 14 percent saying they disagreed with it.
Among those opposing the deal is victims' group Almagor, as well as several bereaved families who presented four petitions to the High Court on Monday in a bid to secure an 11th-hour halt to the release of the prisoners.
In an emotional hearing, with many speakers close to tears, Almagor head Meir Indor said that Shalit's captors had held everyone to ransom.
"Hamas kidnapped not just Gilad but his family and all of Israeli society," Indor said, as Shalit's father, Noam, sat silent and expressionless on the front bench of the packed courtroom.
But late Monday the high court rejected the appeals against the freeing of the Palestinian prisoners saying the decision rests with the government.
"The government alone is responsible for the security of the state, its soldiers and citizens," the judges said, according to the military radio.
Signup to our newsletter and follow us on Facebook and Twitter!
The court has never in its history overturned a government decision to free prisoners involved in militant attacks.
Among the prisoners to be released are Walid Anjas, who received 36 life sentences over a 2002 attack on a Jerusalem bar that killed 11 Israelis, and Nasr Yateyma, who was convicted of planning the 2002 Passover bombing which killed 29.
Others were involved in kidnapping and killing Israeli soldiers.
Israeli officials have acknowledged the deal will be painful for the bereaved relatives but said the agreement was the best deal that could be reached.
Under its terms, 450 male and 27 female prisoners are to be released on Tuesday, with a second batch, whose names have yet to be decided, to follow in the coming two months.
Of the first tranche, 297 will be released into Gaza, 117 will return to their homes in the West Bank, and 15 will return to their families in annexed Arab east Jerusalem.
Seven Arab Israelis will return to homes in Israel, and one woman inmate will go home to her native Jordan.
Another 40 Palestinians will be exiled overseas to countries which so far include Turkey, Syria and Qatar, Hamas officials said.
Exiled Hamas chief Khaled Meshaal was expected to welcome the 40 deportees to Egypt, a Damascus-based spokesman said.
"Shalit will stay (in our hands) until we make sure the Palestinian prisoners are delivered to Egypt, in coordination with Egyptian intelligence," spokesman Izzat al-Rishq told AFP.
Shalit was a 19-year-old corporal when he was captured on June 25, 2006. Three days after he was snatched, 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.
But the operation was unsuccessful and in June 2007, Hamas seized power in Gaza, holding the young soldier at a location which has remained hidden until today.
Hamas has declared Tuesday a national holiday, and three days of celebrations are also to be held in towns and cities across the occupied West Bank.
Israeli sources meanwhile told public radio that a second prisoner swap agreement was imminent with the Egyptian brokers of the deal with Hamas.
The mooted exchange would see the release of US-Israeli joint national Ilan Grapel, who has been in Egyptian custody since June 12 on suspicion of being an Israeli spy, in exchange for 81 Egyptians held in Israel, most of them convicted of common law offences.