JERUSALEM Israel and Gaza's Hamas Islamist rulers have agreed to swap hundreds of Palestinian prisoners for the lone Israeli captive soldier Gilad Shalit, resolving one of the most emotive and intractable issues between them.
Israeli Prime Minister Benjamin Netanyahu announced in Jerusalem that the deal was "finally summarised and both sides signed."
In the Gaza Strip, Hamas confirmed that it only remained to conclude technical arrangements for the exchange in the coming days.
The breakthrough pact, after many false dawns in years of secret efforts to free Shalit since he was captured in 2006, has no direct bearing on Middle East peace negotiations.
But it was virtually certain to improve the climate for restarting talks that have been stalled for over a year.
A source involved in the talks said the long elusive pact had been mediated by Egypt, playing a role which is likely to strengthen Israel's ties with Cairo, which have suffered since the fall of Egyptian leader Hosni Mubarak in the Egyptian revolution this year.
Abu Ubeida, a spokesman for Hamas' armed wing, told Reuters the agreement in principle was sealed.
"We are in the process of completing the technical arrangements to complete the deal within days," he said.
The agreement calls for the release of 1,000 Palestinians in two stages, the first involving 450 to be swapped for Shalit, with the remaining 550 to be freed later.
The exchange was sure to be greeted with relief by both sides.
A campaign by Shalit's family has made him a cause celebre in Israel and his release a test for Netanyahu's government. The Palestinians have long clamoured for the release of hundreds they consider political prisoners.
Israeli television quoted Netanyahu as telling Shalit's parents that ever since he took office three years ago "I've been waiting for the chance to make this telephone call" to inform them of the deal.
The wife of Marwan Barghouti, a charismatic activist seen as a future Palestinian leader, told Reuters in the West Bank that she was eagerly awaiting word that he will be included in the prisoner swap.
In Gaza, the families of men jailed for life by Israel awaited word that their names would be on the list.
The main sticking point in earlier negotiations had been Israel's reluctance to meet Hamas' demands to free prisoners convicted of involvement in lethal attacks against Israelis.
Israel has carried out several lopsided prisoner swaps in the past, notably in 1985 when hundreds of Palestinian prisoners were freed in exchange for several soldiers captured by a guerrilla group in Lebanon.
The ordeal of Shalit, a fresh-faced corporal, transfixed Israel after the tank gunner was captured by militants who tunnelled their way out of Gaza and then forced him back over the border.
He was 19 at the time and had begun his mandatory three-year army service nearly a year previously.
Shalit, a native Israeli who also holds French citizenship, was last seen in a videotape released by his captors in September 2009 showing him looking pale and thin.
He received no visits from the International Committee of the Red Cross, despite many appeals.
The Pentagon releases photographs linked to allegations of abuse of detainees in Iraq and Afghanistan.