Israelis have waited more than five years for their leaders to bring home captured soldier Gilad Shalit, but in the end, it was an unexpected "window of opportunity" that eventually allowed a deal. Analysts and Israeli officials said a confluence of factors, many of them linked to the uprisings across the Middle East, helped push Prime Minister Benjamin Netanyahu to agree a prisoner exchange with the Islamist Hamas movement. The deal, which will see Israel release 1,027 Palestinians in exchange for Shalit, runs the risk of tarnishing Netanyahu's 'tough on terror' image. But pressure to agree a deal increased significantly following the huge political changes brought about by Arab Spring, with Israel fearing it could create conditions that would make it harder to win the soldier's freedom. In announcing the deal on Tuesday night, Netanyahu said he had been required to make a "difficult, but right" decision. He made direct reference to the Arab uprisings, warning that the sweeping changes they were bringing could significantly limit the scope for a deal, were Israel not to seize the moment. "I believe that we have reached the best deal we could have at this time, when storms are sweeping the Middle East," he said in a nationally-televised address. "I do not know if in the near future we would have been able to reach a better deal -- or any deal at all. "It is very possible that this window of opportunity that opened because of the circumstances, would close indefinitely and we would never have been able to bring Gilad home at all." Bolstering Netanyahu's decision to agree the deal was the support of Israel's top military and intelligence officials, including Defence Minister Ehud Barak. Other supporters included army chief Benny Gantz, Tamir Pardo, head of the Mossad spy agency, and Yoram Cohen, head of the domestic intelligence Shin Bet service. All three only recently took up their posts, and Cohen in particular differed sharply with his predecessor Yuval Diskin over the question of releasing Palestinian prisoners in exchange for Shalit. "There are 20,000 Ezzedine al-Qassam fighters in Gaza, another 200 terrorists joining them won't make all the difference," he told reporters on Tuesday night, referring to the armed wing of Hamas -- although he acknowledged such a step would be very hard for those who had lost people to deadly attacks. "This is not a deal that we can say is good but if you want to bring Shalit home there's no other option," he said. "When the conditions were right to absorb the risk, we thought that this was the right thing to do because we couldn't see a better possibility of reaching a deal to bring Shalit home." Cohen suggested the Arab Spring had helped by pushing Hamas to show new flexibility in the negotiations. The Islamist group is reportedly looking to relocate to Cairo from its current base in Damascus, as the Syrian regime presses a deadly crackdown against a nationwide uprising. "Hamas understood they needed Egyptian support and came to the conclusion that they needed to become flexible," Cohen said. In particular, the group accepted Israel's refusal to free several prominent Palestinian prisoners including Fatah leader Marwan Barghuti and Ahmed Saadat, chief of the Popular Front for the Liberation of Palestine. And they agreed to Israel's demand that over 200 Palestinians from the West Bank be deported to Gaza or exiled overseas upon their release. Analysts and members of Palestinian president Mahmud Abbas's government have also suggested that both Israel and Hamas stood to gain by announcing a deal now, drawing attention away from Abbas's popular bid for state membership at the United Nations. "One has to question the timing" of the exchange deal," Palestinian foreign minister Riyad al-Malki said in an interview with France 24 on Thursday. "Is it really intended to boost the popularity of the Israeli government and Hamas vis-a-vis the Palestinian Authority and president Abbas? "That is a really legitimate question to be asked."