Announcement of deal to free soldier Gilad Shalit in exchange for release of 1,027 Palestinians greeted by celebrations.

There have been celebrations in the Gaza Strip and in Jerusalem following the confirmation of a landmark Palestinian-Israeli prisoner swap deal.

More than 1,000 Palestinians are to be freed in exchange for one Israeli soldier, Gilad Shalit, who has been held for more than five years, under the deal announced on Tuesday.

Shalit was captured by Hamas, the Palestinian faction which governs Gaza, in a cross-border raid in 2006. The Israelis have said he will be released within days.

The Israeli cabinet approved the deal after a late-night meeting, with 26 ministers voting in favour and three opposing it.

Khaled Meshaal, the leader of Hamas, confirmed in a televised address from Damascus, Syria, that 1,027 Palestinians in Israeli prisons would be released in exchange for Shalit.

"This is a national achievement that we should be proud of," Meshaal said.

Following the announcement, Palestinians poured out onto the streets in Jabaliya, a refugee camp in Gaza, where celebratory gunfire and car horns could be heard all around.

"It's really important to remember that the first part of the siege on Gaza really started after the capture of Gilad Shalit and intensified after Hamas won the elections and took power in Gaza," she said.

"The people in Gaza have had very much to bear the brunt of the capture of Shalit with a five-year-long siege, which means they haven't been let out of Gaza, exports and imports have been severely restricted, and for some time hardly anything was allowed in."

In two phases

Meshaal said the detainees will be freed in two phases: the first phase will see the release of 450 "in one week", which include all Palestinian women currently in Israeli jails, and in the second phase another 550 will be freed "in two months".

From the 450, 131 will be returned to Gaza, while 110 will be sent home to the West Bank. Six are Israeli Palestinians. Another 203 remaining prisoners will be deported, with 40 barred from Israel and the Palestinian territories.

The list of 1,027 includes 315 prisoners who have been sentenced to life, the result of negotiators giving "priority to those who have spent over 20 years" in jail, Meshaal said.

"We were very keen for this deal to include prisoners from across different categories, from different age groups and from the West Bank and Gaza, from Jerusalem and the Golan [Heights]."

He also stressed that the deal reflected the unity of the Palestinian people, and vowed to fight until "the day all Palestinians imprisoned in Israel are freed".

Two prominent Palestinian prisoners - Marwan Barghouti, the influential Fatah leader, and Ahmed Saadat, head of the Popular Front for the Liberation of Palestine - will not be released as part of the swap deal, Yoram Cohen, the head of Israel's Shin Bet intelligence service, said.

Meshaal's address came soon after that of Binyamin Netanyahu, the Israeli prime minister, in which he said "our son will be home in the coming days" in reference to Shalit.

Negotiations were initiated in Cairo on Thursday under the mediation of Egyptian security and intelligence officials, and an agreement was signed earlier on Tuesday, Netanyahu said.

Later in a tweet, Netanyahu thanked "the Egyptian government and its security forces for their role in mediation and concluding the deal".

Meshaal also thanked Egypt, as well as Qatar, Turkey, Syria and Germany which he said had all been involved in the negotiations.

Israel had made previous attempts to free Shalit through a prisoner swap with Hamas, but talks became bogged down over disagreements about who Israel might free, with both sides blaming one another.

Egypt praised

Egypt is lapping up all the credit and praise, at a time where the interim ruling military council has been facing much criticism from its public, Al Jazeera's Sherine Tadros reported from Cairo.

"In previous times when we felt very close to a Shalit deal - especially a year ago when I was in fact in Gaza - the major sticking point was that the Palestinians felt it was the Egyptians who had faltered on what they offered Israelis," she said.

"But the Arab Spring in Egypt has changed dynamics to a point where both the sides felt they could deal with the Egyptians."

The authorities in Cairo knew how important it was for them to have this kind of trust, and they could expect to make a lot of political capital out of the deal, she said.

Reporting from Jerusalem, Al Jazeera's Cal Perry said both Meshaal and Netanyahu had said "oddly similar things".

"They both said that this deal was a unifying moment, both claiming a victory in their own right," he said.

The swap deal comes at an opportune moment for Netanyahu, who is struggling with his country's deteriorating relations with Cairo, he said.

Second, as prime minister of a country where military service is mandatory, Netanyahu had been under immense pressure from the Shalit family to secure his release, he said.