By Ori Lewis and Nidal al-Mughrabi
JERUSALEM/GAZA (Reuters) - Prospects of a long-elusive deal with Hamas to secure the release of Israeli soldier Gilad Shalit in exchange for 1,000 Palestinian prisoners began to take off in July, Israel's negotiator said on Tuesday.
David Meidan, who did the talking for Israel, said Israeli intelligence identified three months ago that the Islamist movement which rules the Gaza Strip and holds Shalit had become more pragmatic and was ready to do a deal with Egypt as mediator.
"From that point on things took off," said Yoram Cohen, head of Israel's domestic intelligence agency Shin Bet, who briefed reporters along with Meidan.
Rumours of an imminent prisoner-swap agreement with Hamas that would bring Shalit home have surfaced on several occasions in the past three years, and on two occasions a deal was thought to be very close, but final agreement eluded the two sides.
On Tuesday, Israeli Prime Minister Benjamin Netanyahu announced that his government and Hamas had initialled a prisoner swap pact last Thursday and had finalised it on Tuesday.
Israel will free 450 people in the coming days in the first phase of the exchange while Hamas releases Shalit, who was 19 when he was abducted by the Gaza border in 2006. A further 550 Palestinians would be freed later.
Cohen said 203 would go into exile in countries not yet named, 110 would go home to the West Bank and East Jerusalem and 131 to Gaza. Six Israeli Arabs would also be released.
The list did not include Palestinian activist Marwan Barghouti, convicted of murder for his role in attacks on Israelis during a Palestinian uprising, or Ahmed Saadat, a Palestinian faction leader who master-minded the killing of an Israeli cabinet minister in 2001.
SIGNED IN CAIRO
The deal was signed for Hamas by Nizar Awadalah in Cairo at the end of a final session which lasted 24 hours and concluded at breakfast time on Tuesday.
Hamas has lost political leverage to its rival Fatah in recent months as Palestinian President Mahmoud Abbas, the Fatah leader, seized the diplomatic initiative with a campaign to win statehood for Palestine through full United Nations membership.
The armed movement has clamped down on smaller militant groups which carried out cross-border rocket and mortar attacks against Israel, risking Israeli military retaliation.
Hamas leader Khaled Meshaal hailed the swap as "a national achievement" and celebrations broke out in the blockaded enclave which Hamas took over in a brief war with Fatah in 2007.
Cohen and Meidan, the last in a series of Israeli negotiators, praised the Egyptians, saying they played a vital and instrumental role in securing the deal and had facilitated its conclusion in a professional manner.
Israel's relations with Egypt were likely to be reinforced by the cooperation, after months of strain following the toppling of Egyptian leader Hosni Mubarak which stirred fears among Israelis that their peace pact could be revoked by Egypt's future leaders.
Announcing the deal to his cabinet, Netanyahu said he feared time was running out for Shalit amid political upheaval in the Arab world.
"I believe we have reached the best agreement possible at this time when storms are raging in the Middle East. I don't know if we could have reached a better agreement, or even achieved one at all, in the near future," he said.
"It's possible that this window of opportunity would have closed for good and we never would have brought Gilad home."
In 2009, negotiations on a swap foundered when Israel described 100 prisoners whose release was sought by Hamas as posing particular security risks and said they would never be freed.
A non-Israeli official involved in the talks, but speaking on condition of anonymity, also told Reuters in Gaza that the ice began to break three months ago, when Israel and Hamas held indirect talks and both began to show more flexibility.
"Israel offered a big part of those names. Hamas sacrificed some names as well and they met in the middle," he said.
He said Israel had agreed to free some of the top militants whose names are not well known in Israel. Meidan said Israel had refused to free some of "the worst murderers."
Netanyahu was involved the whole time through his negotiators deal, the official told Reuters in Gaza.
Netanyahu telephoned Egypt's chief of intelligence Murad Muwafi when the agreement was made in principle and gave it the green light, and Israel's President Shimon Peres agreed to amnesty for those Palestinians to be freed.
Popular revolt in the Arab world had helped improve the negotiating climate, he said, supporting Israeli comments that Hamas -- which was slow to endorse the revolutions in Tunisia and Egypt -- felt its room for manoeuvre shrinking.
"Circumstances changed and Israel was aware of that and the changes in the surrounding areas helped getting things done."
(Writing by Douglas Hamilton)