Detainees released into West Bank and Gaza in second and final phase of swap for Israeli soldier Gilad Shalit.

Israel has released 550 Palestinian prisoners in the second stage of a deal with Hamas, with nearly all of the prisoners passing through a crossing into the West Bank where they were greeted by thousands of Palestinians.

Though Hamas, which rules the Gaza Strip, had reached the deal with Israel, most of the crowd on Sunday waved flags from the rival Fatah faction of Palestinian President Mahmoud Abbas, the dominant party in the West Bank.

Hours before the release got under way, hundreds of Palestinians clashed with Israeli soldiers at a West Bank checkpoint. They were among the crowd gathered at Beitunia, southwest of Ramallah, anxiously awaiting their relatives who were being freed.

Tempers ran high and when youths began pushing the nearby security fence and throwing rocks, soldiers fired tear gas and stun grenades, witnesses said.

Sunday’s release completes the Egyptian-brokered deal to exchange a total of 1,027 prisoners for Gilad Shalit, who was captured by Gaza fighters in June 2006. Shalit returned home on October 18 when Israel freed the first batch of 477 prisoners.

Al Jazeera’s Cal Perry, reporting from Ramallah where thousands had gathered to greet the prisoners, pointed out that Sunday’s group was “very unlike” the first round of released prisoners.

“That batch was released after very, very difficult negotiations [with Hamas]. This was a list picked by the Israelis,” said Perry.

‘Great achievement’

The prisoners that Israel freed in the first round included dozens of fighters serving life sentences for involvement in deadly attacks. Their releases set off ecstatic celebrations in the Palestinian territories, particularly Hamas’ Gaza stronghold.

In Gaza, Hamas spokesman Fawzi Barhoum said the movement welcomed the release of all prisoners, regardless of their political affiliation.

“We are proud of this great achievement,” he said.

He said Hamas leaders would welcome all returning prisoners, and offer them assistance with housing and employment.

Our correspondent said both Hamas and Israel are capitalising on the high-profile nature of the Shalit trade to “play a public relations game”.

“Both sides are still trying to work this to their favour politically,” he said.

After the release, some 4,250 Palestinians remain in Israeli prisons for security-related offences, the Israel Prison Service has said. That is down from almost 5,300 before the Shalit deal, although new arrests have since been made, while others have been released.