JERUSALEM — Israeli and Hamas have reached a deal to free a captured Israeli soldier held in the Gaza Strip in exchange for more than 1,000 Palestinian prisoners, both sides said Tuesday, capping five years of painful negotiations that have repeatedly collapsed in fingerpointing and violence.
The deal, brokered by the new Egyptian government, would bring home Sgt. Gilad Schalit, who was captured in a cross-border raid in June 2006 by Palestinian militants who burrowed into Israel and dragged him into Gaza. Little has been known about his fate since then.
Hamas and Israel are bitter enemies. Hamas has sent dozens of suicide bombers into Israel, killing hundreds, and Israel blockaded Gaza after Hamas seized power there in 2007, carrying out a large-scale invasion in 2009 to try to stop daily rocket attacks on Israel.
Israel's prime minister, Benjamin Netanyahu, convened an urgent Cabinet meeting Tuesday night to approve the deal.
"Gilad will return to Israel in the coming days," Netanyahu declared in a nationally televised address before entering the meeting.
Effusively thanking Egyptian mediators, he said the deal was signed earlier in the day after being initialed last Thursday.
In Cairo, Egypt's state TV said Egypt succeeded in sealing the exchange. An Egyptian security described his government's role as the guarantor of the deal.
In the past few days, a group of Israeli officials were in Cairo, and Hamas officials arrived to Cairo on Monday.
In Damascus, Hamas' supreme leader, Khaled Mashaal, confirmed the deal, saying a total of 1,027 Palestinian prisoners would be freed in two phases. He said Israel would free 450 prisoners within a week, with the remainder released in two months.
"This is a national achievement for the whole Palestinian people. All are struggling, nationalists and we all have sacrificed," he told a news conference. He said he was pained not to be able to release the thousands of remaining prisoners held by Israel.
Several Hamas officials, speaking on condition of anonymity, said the leader of a Palestinian faction, Ahmed Saadat, and the most prominent prisoner, Marwan Barghouti, would be included in the deal. They spoke on condition of anonymity pending a formal announcement.
Saadat was convicted of planning the assassination of an Israeli Cabinet minister in 2001. Barghouti was the top local commander of Fatah, the movement of President Mahmoud Abbas, when he was arrested in 2002 and convicted of a role in deadly attacks against Israelis. He is serving multiple life terms.
Neither Saadat nor Barghouti belongs to Hamas, but Hamas is eager to portray itself as representing all Palestinians. The Islamic militant group is in a bitter rivalry with Abbas, who is enjoying a burst of popularity after defying Israel and the U.S. and seeking membership for the Palestinians at the U.N.
Israel had previously balked at Hamas' demands because many of the prisoners are serving lengthy sentences for deadly attacks on Israelis, and critics have warned that the militants could resume violence once they are freed. Mashaal said more than 300 prisoners are serving life terms.
In his televised addressed, Netanyahu acknowledged the pain of families who have lost loved ones to Palestinian violence.
"This is a tough decision. My heart is with the families of terror attacks," he said. "I believe we got the best deal that we could get, considering the storms of the Middle East."
Schalit's plight has captured the attention of Israel, where military service is mandatory for Jewish citizens, and people identify with the Schalit family's ordeal. Many cars carry bumper stickers with Schalit's name, and people often wear T-shirts with the soldier's picture.
Hamas has allowed no access to Schalit, and released only a brief audio recording and a videotaped statement early in his five years in captivity.
The soldier's father, Noam, has become a well-known public figure by pushing for his son's freedom. In the summer of 2010, he led a march across Israel over several days to draw attention to his plight. He also has slept in a tent outside Netanyahu's Jerusalem 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.
Likewise, the plight of Palestinian prisoners is deeply emotional among Palestinians. Virtually every Palestinian has a relative who has served time in an Israeli prison, and Palestinians routinely hold large demonstrations where they hold up posters of their imprisoned loved ones.
Israel has been carrying out unequal prisoner swaps for decades, including handing over 4,600 Palestinian and Lebanese captives in 1983 in exchange for six captured Israeli soldiers. In 2008, it even freed Arab prisoners for the bodies of two soldiers killed by Hezbollah guerrillas in Lebanon.
In the northern Gaza town of Jabaliya, thousands of Hamas supporters flocked the streets, led by masked militant commanders. Cars laden with loudspeakers praised Hamas.
Thousands of others rushed to Gaza's border with Egypt clutching Palestinian and Egyptian flags, tossing flowers and cheering.
Announcement of the deal coincided with a hunger strike launched by hundreds of Palestinian prisoners seeking better conditions. The prisoners had been demanding the restoration of key privileges, such as having Arabic TV channels and being allowed to take university course, which have been stripped since Schalit's capture. Israel is holding more than 5,000 prisoners.
Abbas, traveling in South America, praised the deal. "We have waited for this for a long time. We demand that all prisoners be released from the Israeli prisons, and we appreciate the Egyptian efforts," he said.
All sides said that Egypt's new government, which took power after ousting longtime President Hosni Mubarak in February, was integral to the deal.
The Palestinians have been divided between rival governments, Abbas' Palestinian Authority in the West Bank and Hamas' regime in Gaza, since Hamas overran the coastal strip in 2007.
Netanyahu is eager for a domestic boost. The Israeli leader has faced growing criticism for a deadlock in peace efforts with the Palestinians, as well as a series of domestic protests over the country's steep cost of living. Bringing Schalit home could make Netanyahu a hero.
Diaa Hadid, Aaron Heller and Daniel Estrin in Jerusalem; Sarah El Deeb in Cairo and Ibrahim Barzak in Gaza City contributed reporting.