They had complete control of Gaza and the whole Sinai Peninsula. Which quadrupled the size of land Israel controlled. But they gave control back to Egypt to make peace in 1978. Then in 2004-05 they completely withdrew from Gaza and dismantled and (sometimes forcefully) removed all settlements and settlers in an attempt at making peace.
Now in the first situation since for 45 years, the two groups have maintained peace. The other Arab nations were less peaceful with Israel, however. Islamic jihadists even assassinated Sadat. But there has been peace with Israel.
In the second, they used it an opportunity to essentially become a terrorist controlled territory. And increased the attacks. And reject any peace negotiations.
So what should Israel do? What solution might you suggest.
If they want to make Gaza a independent state, then let them have unrestricted maritime trade access with the world. Build them enough water and power capability to self sustain - then they can truly say 'we did all that we could do, our responsibility is over'
This escape from new york style prison city with no trade, no water, no electricity, and no imports, isn't going to make peaceful neighbors.
Populations that co-depend on each other for economic success are more peaceful, trade, and integration are keys to long term stability.