The formation of HAMAS was aided by Israel. As it says at Wikipedia -
“Thanks to Israel’s intelligence agency Mossad (Israel’s Institute for Intelligence and Special Tasks), the Islamists were allowed to reinforce their presence in the occupied territories. Meanwhile, the members of Fatah (Movement for the National Liberation of Palestine) and the Palestinian Left were subjected to the most brutal form of repression”, according to L'Humanité. Indeed Israel supported and encouraged Hamas' early growth in an effort to undermine the secular Fatah movement of Yasser Arafat.
These days, HAMAS, and/or those that HAMAS doesn't stop, are launching unguided home-made rockets into Israel causing occasional injuries and damage to property. Operation Cast Lead, that resulted in the deaths of over 1,000 Palestinians and widespread destruction in late 2008 and early 2009, was launched in an attempt to stop the rockets.
One would be tempted to say that Israel's early support of what was to become HAMAS backfired, resulting in the most fierce opposition to Israel to date.
So how could HAMAS possibly be helping Israel?
Consider two parties arguing over land. One party is warlike, threatening the other with destruction. The second party speaks only of peace and the need to defend itself. For the ordinary person not a party to the dispute, where would sympathy lie? Quite naturally it would be with the peace seeking party.
But suppose that the party of peace was just as determined to seize land as the party of war and that it had found a method to do so, not by fighting, but through illegal settlement of its citizens on the land of others over a period of years?
Still further, suppose that in order to carry out this settlement project, the party of peace needed financial support from an outside source that could be depended upon year in and year out.
How could these two projects - the settlements and the funding - be kept going reliably, especially when the entire world with the exception of the United States was denouncing the settlements?
Enter HAMAS to the rescue! By pin-pricking Israel with home-made rockets, HAMAS allows Israel to continually sound the alarm of self-defense, turning the eyes of the world to rockets while taking those same eyes off of the settlement project. "We're under attack!" brings in the funds from the United States and the settlements continue.
Now, having rockets come into Israel is no party and plenty of folks living in the Sderot (sdare-OAT) area are living with high anxiety. There is no doubt that the rocket launches are wrong and should be stopped.
But so are the settlements wrong, even as they have, from the settler perspective, become a huge success. They have proceeded without meaningful restraint for decades with the full support of each Israeli government and generous subsidies from those governments as detailed (in 2002 but still accurate today) by B'Tselem.
As Ariel Sharon knew, Gaza was a hopeless cause for a land grab - too many Palestinians in too small a space. The small number of Israelis heavily guarded by soldiers in Gaza looked bad. So it was goodbye and good riddance. But the West Bank is a different story, with Palestinians more spread out and relatively empty land to grab...ideal for expansion. Things have gone so well that even urban Palestinian areas are being pressured by settlements now - the pincers are closing on East Jerusalem as exemplified at Sheikh Jarrah.
Of course the world objects, but as long as the United States Congress keeps the money flowing, who cares? And with those rocket attacks bringing in even MORE money ($220 million this year for the Iron Dome anti-missile system that pays an Israeli company to produce it for Israel) can the party of peace possibly hope that things could be any better?