Israel's Cabinet has approved a prisoner swap with Hamas that will bring home a captured Israeli soldier in exchange for more than 1,000 Palestinian prisoners.
The Cabinet approved the deal in a 26-3 vote, after a debate that lasted more than three hours.
Ahead of the vote, Israel's hardline foreign minister, Avigdor Lieberman, said he would oppose the deal, arguing that freeing convicted militants would lead to new violence.
Israeli Prime Minister Benjamin Netanyahu implored his Cabinet to support the deal, saying it was the best Israel could hope for.
"This is a difficult decision, but leadership is tested at moments like this, on the ability to make difficult decisions," Netanyahu said in a statement.
Netanyahu says the Israeli soldier will be home in the "coming days" after the prisoner exchange was agreed on.
Benjamin Netanyahu said late Tuesday that a deal with Hamas was initialed last Thursday and signed Tuesday.
Sgt. Gilad Shalit, 25, has spent more than five years in captivity, kidnapped by Hamas terrorists on June 25, 2006, from within Israeli territory and taken to the Gaza Strip.
The kidnapping was part of an unprovoked attack that involved seven armed terrorists using a tunnel dug under the Israel-Gaza border. Shalit was 19 at the time of his abduction.
Israel had previously balked at Hamas' demands because some of the prisoners are serving lengthy sentences for deadly attacks on Israelis.
The Hamas official website confirmed the deal, calling on supporters to gather now to celebrate the "victory and the expected release of hundreds of Palestinian prisoners," Fox News confirms.
Other sticking points in the past have been whether prisoners would be allowed to return home to the West Bank and Gaza Strip, or be sent into exile instead. Exact details of the deal were not immediately available.
But Hamas chief Khaled Mashaal says 450 prisoners will be released within a week, and the rest of 1,027 prisoners two months later in the swap deal.
Mashaal described Tuesday the prison exchange as "national achievement" for the Palestinians.
He said more than 300 Palestinians sentenced to life sentences will be freed along with all 27 Palestinian women in Israeli prisons. It is not clear at what stage the Israeli Sgt. Gilad Schalit will be released.
Speaking in a televised address from Damascus, Syria, Mashaal said he was pained not to be able to release all the remaining prisoners.
Israeli groups representing the families of people killed by Palestinian militants have objected to a prisoner swap, saying it would be too painful to allow their children's murderers to go free.
Netanyahu said in a televised address that he understands the pain of Israeli families who have lost loved ones to Palestinian violence. But he said he got "the best deal we could get" given the turmoil in the region.
Shalit celebrated his 25th birthday on August 28, which was his sixth birthday in captivity.
Schalit's plight captured the attention of Israel, where military service is mandatory for Jewish citizens, and people identify with the Schalit family's pain.
Hamas released only a brief audio recording and a videotaped statement early in Schalit's five years in captivity.
The soldier's father, Noam, has become a well-known public figure through a a campaign to win his son's freedom, leading demonstrations and sleeping in a tent outside Netanyahu's residence.
Dozens of Israelis converged on the tent late Tuesday to offer support to the family. The tiny structure is decorated with pictures of Schalit, as well as a large sign with the number 1,934, the number of days he has been in captivity.
Schalit's parents sat in the tent, smiling as people flooded to the area and cars honked horns in excitement.
The Associated Press contributed to this report.