The release of an Israeli soldier by Hamas as part of a prisoner exchange with Israel is reshaping complex regional ties, mostly in favor of Gaza's once isolated Islamic militant rulers.
The swap, mediated by Egypt, has strengthened Hamas' bond with the regional powerhouse next door and removed a major irritant from its fraught relationship with Israel.
Trading Sgt. Gilad Schalit for 1,027 Palestinians held by Israel also boosted Hamas' flagging popularity at home, at the expense of its main domestic rival, Palestinian President Mahmoud Abbas, who was forced to watch from the sidelines.
It's not clear whether any of this will last, especially if Hamas acts on threats to capture more Israeli soldiers in an attempt to free 4,300 Palestinians still in Israeli prisons. And a fickle Palestinian public could quickly forget about the swap; only a month ago, it cheered Abbas for bypassing talks with Israel to seek U.N. recognition for a state of Palestine.
For now, though, Hamas is riding high.
Hamas leaders portrayed the swap, the most lopsided in Israel's history, as a victory for the movement's hard-line ideology. Israel only understands the language of force, they said in a jab at Abbas, who until recently had put his faith in negotiations, with little to show for it.
In the euphoria over Tuesday's homecoming of the first group of 477 inmates, including more than 280 serving life sentences, criticism of the deal was muted. Still, the Islamists made concessions they previously rejected, including that key militant leaders remain behind bars and that dozens of West Bankers be deported to Gaza or sent into exile.
Gaza's 1.5 million people have paid a steep price for Schalit's 2006 capture just outside their territory.
Schalit's incarceration was a key reason for the ongoing border blockade imposed by Israel. In the month following his capture, Israeli military raids killed more than 200 Palestinians. Hamas' refusal to free Schalit also played a role, along with rocket fire from Gaza, in Israel's decision to wage a three-week war nearly three years ago, killing hundreds of Gazans and destroying thousands of homes. The closure devastated the economy and drove thousands more deeper into poverty.
However, some now say it was a price worth paying, and tens of thousands showed up for homecoming celebrations Tuesday — signs of renewed support for the Islamists who had seen their popularity erode over their heavy-handed rule and Gaza's ongoing isolation.
"What we suffered in five years — we forgot it yesterday," said Gaza farmer Nabil Abu Namus, 43, referring to the swap. Abu Namus said he lost seven members of his clan in different bouts of fighting and his four-story family home was razed in the Gaza war.
Beyond the popularity at home, the swap has deepened Hamas' relationship with Egypt, its most important ally.
The swap helped boost Egypt's stature as a regional power against competitors Iran and Turkey. In the final phase of the negotiations, Hamas showed flexibility to ensure success, in part to avoid alienating Egypt, analysts said. Hamas made sure that Schalit's first interview, after emerging from captivity, was given to Egyptian television, apparently to highlight Egypt's role.
Ties had been strained under Egypt's pro-Western President Hosni Mubarak, deposed in February and replaced by a transitional government.
"We rebuilt trust with Hamas and our relationship is now more in-depth," said an Egyptian security official, speaking on condition of anonymity because of the delicate diplomacy involved. "Hamas showed strong commitment to protect Egypt's border with Gaza and cooperate on security issues."
In exchange, Egypt has given Hamas officials greater leeway on its soil than would have been thinkable under Mubarak. On Tuesday, Hamas' supreme leader, Khaled Mashaal, held court in a Cairo luxury hotel, greeting released prisoners.
However, Hamas officials quickly doused speculation that the movement — increasingly uncomfortable with its headquarters in Syria because of President Bashar Assad's brutal crackdown on dissent there — would try to relocate to Cairo.
Egypt's next goal is to push for a unity deal between Hamas and Abbas' Fatah movement, said an official with knowledge of those efforts. Having rival Palestinian governments — Abbas' in the West Bank and Hamas in Gaza — endangers the region, said the official, speaking on condition of anonymity because he was not authorized to brief reporters.
Abbas and Mashaal are to meet in coming days in Cairo to try to break the impasse that has held up a reconciliation agreement reached in the spring. Skeptics say a breakthrough is unlikely because of deep ideological differences and because each side wants to safeguard achievements in the territory it controls.
"Without heavy intervention from Egypt or the Arab League, neither Hamas nor Fatah will implement reconciliation," said Mhaimar Abusada, a political analyst in Gaza.
The release of dozens of prisoners, among them prominent Hamas militants, to the West Bank has raised concerns, especially in Israel, that the group will be able to recover there. Over the past four years, since Hamas took Gaza from him by force, Abbas systematically dismantled the Hamas infrastructure in the West Bank, closing institutions, arresting activists and drying up funding.
However, Hamas said there's no sign Abbas is easing up. "The Palestinian Authority (of Abbas) has not stopped arresting and summoning Hamas supporters, even during and after the swap," complained Hassan Yousef, a Hamas leader in the West Bank.
In Israel, the swap was preceded by an anguished debate. Opponents said trading a large number of prisoners for a lone Israeli invites more attempts to capture soldiers, and that the released prisoners could carry out new attacks.
Others said the successful negotiations with Hamas, albeit indirect, could help establish a more pragmatic relationship between the arch foes. The same channel could be used to keep the peace on the Gaza-Israel border and prevent an escalation if Gaza militants resume rocket fire on Israel.
Hamas officials say that as part of the deal, Israel promised to further ease its blockade of Gaza. Israeli officials deny this.
More than a year ago, Israel resumed permitting most imports to Gaza through its border and a few exports — a significant easing but insufficient for Gaza's needs.
Nahman Shai, a legislator from Israel's opposition party Kadima, said Israel should rethink its Gaza policy. "The goal (of the blockade) was not to make Gaza starve," he said. "It was to put pressure on the government of Hamas to get Schalit back."
Laub reported from Ramallah, West Bank. Associated Press writers Josef Federman, Tia Goldenberg and Dalia Nammari in Jerusalem, and Diaa Hadid in Gaza contributed reporting.