Most war is unjustified. Violent resistance is almost never unjustified if one lacks access to elections.
But violent resistance that targets civilians robs itself and its cause of justice until that rot is removed and regretted. It's not only morally wrong. It's strategically stupid. Terrorist tactics do not work–they radicalize the enemy and unfavorably polarize the alliance space.
Remember the videos Ukraine circulated of sharing tea with Russian POWs? Imagine if Hamas had only targeted military outposts and then shared images like that one from its bunkers under Gaza City?
A cause can be fundamentally justified but still piss away its advantages with poor strategy. At the end of the day, Hamas has acted in Iran's interests. Not the Palestinians'. (Same with Hezbollah. Same with the Houthis, though to a marginally lesser degree.)