The Gaza Strip and West Bank gave a jubilant welcome on Tuesday to hundreds of Palestinians freed from Israeli prisons in exchange for the release of Gilad Shalit, the Israeli soldier held for five years by the enclave's Islamist rulers, Hamas.

Fire-crackers, klaxons and cheering carloads of flag-waving young men raised the noise level steadily in Gaza city as thousands converged on a central square for a mass rally with speeches scheduled by Hamas leaders and well-known militants just liberated in the swap mediated by Egypt.

next previous 6 of 6 | A Palestinian prisoner is reunited with his mother after being released from an Israeli prison. Credit: Hadar Cohen 1 of 6 | A Israeli Arab prisoner is reunited with his family in Umm al-Fahm upon being released from an Israeli prison. Credit: Itzik Ben Malchi 2 of 6 | Egyptian soldiers stand guard while the convoy of busescarrying freed Palestinianprisoners from Israelijails leaves the Egyptian terminal of the Gaza Egypt border crossing of Rafah. Credit: AP

In Ramallah, thousands packed into the headquarters of the Palestinian presidency to greet prisoners released into the West Bank. President Mahmoud Abbas and Hassan Youssef, a senior member of the Hamas group, both delivered speeches in a rare show of national unity.

"We thank God for your return and your safety," Abbas said, greeting the prisoners. "You are freedom fighters and holy warriors for the sake of God and the homeland." He also said that Israel had promised him to free more prisoners following the two-stage swap. It was the first mention of such a release.

"We hope soon to see [Marwan] Barghouti and [Ahmed] Saadat, as well as every prisoner freed," Abbas told the thousands of cheering supporters and relatives, referring to two high-profile prisoners who Israel had refused to release.

Open gallery view Prisoners in the Shalit swap are taken from Ketziot prison to an IDF base on the Gaza border; Saleh Aruri was among those released. Credit: Ilan Assayag

Yousef said the deal "gives the Palestinians hope that more prisoners can be released."

Gaza declared a national holiday and schools were closed.

The road from the Egyptian border with Egypt was turned into a military zone and sealed off. Dozens of masked, heavily-armed men of the Izz el-Deen Al-Qassam militia waited in convoy to escort buses carrying the freed men north to Gaza city.

"I think the deal represents something great for the Palestinian people. Those who are still in jail are happy for those who have been released." said Hamas deputy leader in exile, Moussa Abu Marzouk, who greeted prisoners arriving in Egypt from Israel.

Patriotic songs blared from loudspeakers as prisoners arrived to a heroes' welcome at the Rafah crossing. Some kissed the soil as they arrived. Some were carried on the shoulders of happy relatives. Women ululated and men chanted Allahu akbar [God is greatest].

Hamas leader in Gaza, Ismail Haniyeh, joined scores of officials to greet freed prisoners coming in from Egypt, along with hundreds of family members impatient for the big reunion.

Haniyeh kissed their foreheads, paying special respect to Yehya Al-Sinwar, a top Hamas security strategist who spent 23 years in jail, and his deputy Rawhi Mushtaha who was also serving a life sentence.

"Thank you to the forces of the resistance for returning us as liberated heroes," said one prisoner.

In the West Bank, hundreds of Palestinians waving flags of Palestinian parties including Hamas and the Fatah movement led by Abbas were gathered over the course of the morning at the crossing where they expected Israel to set the prisoners free, dancing, singing and playing national songs all morning.

But violence erupted when the Israelis announced over loud speakers that the prisoners had been taken by an alternative route. Frustrated youths hurled rocks and Israeli security forces responded with tear gas.

In Gaza, a densely-packed sprawl of low-rise concrete on the Mediterranean coast in sight of Israel, thousands gathered for a mass rally around a stage backed by a mural bearing portraits of top militants who were not released, with the words: "We will not forget you."

The web of electricity cables slung over Gaza's main streets was decorated with the green flags of Hamas. The streets were full of men in pick-ups, convertibles and rickshaw trucks waving the brightly-colored banners of Gaza's militant factions.

A wall painting lampooned Israeli Prime Minister Benjamin Netanyahu, depicting him with his face ground into the dirt by the boot of a gunman, signing a paper with words "swap deal".

Hamas, whose gunmen seized Shalit in a cross-border raid in 2006, has declared the prisoner exchange a victory over Israel and a vindication of its policy of armed resistance over the peace-seeking policy of Abbas.

Israel is setting free 1,027 Palestinians in return for the liberty of Shalit. Some have spent 30 years behind bars for violent attacks against Israel and its occupation of land taken in the 1967 Six-Day War.

More than 100 of the 477 prisoners released in the first phase of the exchange were taken to the West Bank. The rest were brought to Gaza, apart from 41 who were due to fly out from Cairo to exile in Turkey, Syria or Qatar.

Hamas and other Gaza militant groups have vowed to seize more Israeli hostages for exchange until all 5,000 Palestinians still in Israeli prisons are released.

"The rest of the prisoners must be released because if they are not released in a normal way they will be released in other ways," said Hamas deputy leader Abu Marzouk.