It's the same reason that Sharon invaded Lebanon when the PLO was observing a UN brokered ceasefire in 1982. When you don't want to negotiate a just solution to the Palestinian question, you need to justify your rejectionism, and what better way to do that than have your adversaries as extremists and "terrorists" Israel used to have Arafat to demonize, then they got Abbas, who wasn't so easy to dismiss as a "partner for peace" Thus they need Hamas. The ugly truth that most Israelis don't want to admit is that the Israeli military/security establishment likes the status quo, as they can continue colonizing the West Bank and East Jerusalem while claiming Palestinian "terrorists" aren't ready for a state.
Australian police arrest 5 over shooting 'linked to terrorism' (Reuters)
from the article: Israel needs to rethink its Gaza strategy before it's too late