Israel has said that the leaders of Hamas are allowed to leave https://www.dw.com/en/netanyahu-says-hamas-leaders-will-be-a... . If they release the remaining hostages and do that, the war could end. The U.S. inflicted horrible damage on Germany and Japan in WWII until the governments of those countries were toppled. Israel similarly has the right to defend itself by destroying Hamas.