Next story in Mideast & N. Africa

Hamas militants pray before going to pay their respects to freed Palestinian prisoners in Rafah, southern Gaza Strip, on Wednesday. Tens of thousands of flag-waving Palestinians celebrated the homecoming of hundreds of prisoners exchanged for an Israeli soldier on Tuesday.

GAZA CITY, Gaza Strip — 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.

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.

Egyptian ties
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.

AP

In this photo released by the Israeli Defense Ministry, released Israeli soldier Gilad Schalit, reunites with his father Noam, right at the Tel Nof Air base in southern Israel, Tuesday, Oct. 18, 2011. Looking thin, weary and dazed, Schalit returned home Tuesday from more than five years of captivity in the Gaza Strip in exchange for hundreds of Palestinian prisoners whose joyful families greeted them with massive celebrations. (AP Photo/ Defense Ministry) EDITORIAL USE ONLY:

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.

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.

Anguished debate
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."

Video: Israel, West Bank celebrate homecoming

Transcript of: Israel, West Bank celebrate homecoming

BRIAN WILLIAMS, anchor:Now to the big news out of the
Middle East
today. It was a prisoner swap, one man for a thousand others.
Gilad Shalit
, an Israeli soldier captured by
Hamas
and held captive for five years, was exchanged today for a thousand Palestinian prisoners who have spent years in Israeli jails. While there were joyous welcomes for those released, the questions about this deal started almost immediately. We get our report tonight from
NBC
's
Ayman Mohyeldin
.

AYMAN MOHYELDIN reporting:Corporal
Gilad Shalit
returned home to
Israel
a
national hero
, saluted by his country's leadership, welcomed by friends and neighbors, embraced by family. His first words as a free man came even before he was back on Israeli soil, in an interview on state
TV inEgypt
, the country that brokered today's release.

Mr. GILAD SHALIT:

MOHYELDIN:Israel
is a nation where every man and woman serves in the military, a society that promises to leave no soldier behind, and
Shalit
's freedom had become a national obsession, starting with his capture by Palestinian fighters five years ago when he was a frail 19-year-old conscript. But some in
Israel
say his release came at a very high price. In return,
Israel
promised to release more than a thousand Palestinian prisoners, many of them serving time for terrorism and murder. Four hundred and seventy-seven were freed today and the streets of
Gaza
were filled with tens of thousands of joyful Palestinians eager to welcome them home. There were emotional homecomings in the
West Bank
as well. Among them,
Qahira Saadi
, who was serving a life sentence in
Israel
. She got a hero's welcome of her own.
Shalit
's captors,
Hamas
, called today's release a victory for the Palestinian struggle and vowed to capture more Israeli soldiers in order to secure the release of the more than 5,000 prisoners still in Israeli jails. But
Israel
is celebrating today, too. An overwhelming majority of Israelis support the swap even if some are worried it may encourage more attacks. As both sides celebrated today, clashes between Palestinian youths and Israeli soldiers in the
West Bank
served as a painful reminder peace is no closer than it was when
Shalit
was first captured. Now, that interview
Gilad Shalit
gave with
Egyptian television
was not part of the deal,
Brian
, and certainly caused a -- quite a bit of controversy in
Israel
. But the world is really interested in hearing what he has to say.

WILLIAMS:And we want to welcome you, by the way, to our family.
Ayman
, for our viewers just joining us, is a native and a veteran of the region. Great to have you. Thanks for your reporting.