JERUSALEM — A prisoner swap that will exchange one hostage Israeli soldier for 1,027 jailed Palestinians was being hailed Wednesday as a victory for both Israeli Prime Minister Benjamin Netanyahu and the leadership of Hamas in the Gaza Strip, a supreme irony in a world where Israel and Hamas have vowed to destroy each other.
For Netanyahu, the exchange ends a long-standing drama that's gripped Israel since Palestinian militants kidnapped the soldier, Gilad Shalit, in June 2006. Netanyahu said he feared that if the standoff over Shalit went on any longer, the changing dynamics of the region would make reaching an agreement impossible.
Intelligence officials said they'd urged Netanyahu to move before next month's scheduled elections in Egypt.
"It's possible that in the near future this window of opportunity would close completely. It's unclear where this storm is headed," Netanyahu said, referring to the Arab Spring revolts that toppled Egypt's Israel-friendly former president, Hosni Mubarak.
Never miss a local story.
For Hamas, the prisoner deal pushes it back to the fore of Palestinian politics after a month in which Palestinian Authority President Mahmoud Abbas, the leader of the Fatah political party, has been hailed for pressing a Palestinian statehood application at the United Nations.
The prisoner exchange has "restored the shine to Hamas," said Tala Okal, a Gaza-based commentator. "The Hamas movement is sending a message: that negotiations are not worth it, and its method, resistance, is the one that produces results."
Which Palestinians will be released as part of the exchange will be announced Sunday, Israeli officials said. Of them, 450 will be released next Tuesday, most to the West Bank and the Gaza Strip, and a small group into exile.
By then, Shalit is to have been moved to Egypt. Once it's confirmed that the Palestinians have been released, Shalit will be flown to Israel and reunited with his family in their home in northern Israel.
The remainder of the Palestinians will be released after Shalit arrives in Israel.
Shalit's family members, who've been keeping a vigil in a tent outside Netanyahu's residence for the past two years, made their way home Wednesday.
Hundreds of people gathered at the tent to wish the family well. Outside the tent, a sign was hung with the number of days since Shalit was captured: 1,935. Each day, a member of the family or one of the supporters had changed the number, though they said Wednesday that they'd cease their count.
"We don't need to count anymore. But we are not taking down the tent. The struggle to bring Gilad home is not over until we see him in our home," said Noam Shalit, Gilad's father.
In the West Bank and Gaza, the families of prisoners in Israeli jails began to prepare as well, in the hopes that their loved ones would be among those released.
"Hamas returns our brothers and sisters to their families," said Abu Obeida, a spokesman for Hamas' military wing. "We will continue to fight for the freedom of our brothers in the Israeli prisons."
Hamas militants, along with two other militant organizations, the People's Resistance and the Army of Islam, took part in the operation on June 25, 2006, that resulted in Shalit being captured.
Since then, more than a dozen mediators have tried to reach a prisoner exchange deal.
Speaking to Israel's Channel 2 television, Ami Ayalon, a Labor party member and former head of Israel's Shin Bet security agency, said the deal could have been reached years ago, but the timing "was not right."
Shin Bet chief Yoram Cohen said Israeli intelligence officers had urged Israeli leaders to reach a deal before the Egyptian elections, now slated to begin Nov. 28.
Israel and Hamas thanked Egypt for its role in mediating the deal. Part of the agreement saw Israel apologize for the deaths of several Egyptian police officers who were killed inadvertently as Israeli security troops pursued Palestinian gunmen suspected of killing eight Israelis.
Israel has been watching warily as its relationship with Egypt deteriorated in the months since Mubarak resigned. Egypt opened its border crossing with Gaza and hosted a signing ceremony at which Fatah and Hamas agreed to a unity government.
The Egyptian elections will lead to a new government, one that's expected to be less friendly toward negotiations with Israel.
"It was clear there was a window to achieve something, and that window would be squeezed shut after the elections," said one intelligence official, who spoke only under the condition of anonymity because he wasn't authorized to speak publicly on the matter.
(Frenkel is a McClatchy special correspondent.)
MORE FROM MCCLATCHY
Follow McClatchy on Twitter.