There are no clean hands in history
--
It's an undeniable fact that most of us would not be thinking, let alone speaking about Palestine liberation had it not been for Hamas & the courageous yet violent step they took to challenge the thug that was stomping on the face of Palestinian people for nearly a century, humiliating them while attacking their dignity — physical & psychological, most importantly making this state of subjugation permanent. They forced the enemy to show his true colors out in the open. We now know not just the enemy but all other enemies who are his bed fellows that are the root cause of Palestinian suffering.
As to whether Hamas is more like a criminal gang within the prison (or) That's the only form of resistance that prisoners are allowed to build that can actually withstand against an inhuman prison authority is something history would judge, once the blood becomes dry.
It goes without saying Hamas is definitely not an ally. But one thing that can't be denied to them is this: Every one of those Hamas fighters who breached the Gaza prison (or more like a 2020s variation of a concentration camp) fences & walls on Oct 7th knew most of them would likely be killed in most brutal manner by the prison guards on the otherside of the prison wall, yet they breached it anyways & slaughtered the guards along with other "civilians", many of whom were benefiting from and enjoying the fruits of Palestinian imprisonment, in peace, right outside prison gates. Hamas, one of the forms Palestinian resistance takes, took many Israeli civilians hostage as a form of insurance, knowing the enemy is inhuman & the only insurance they have against that brutal enemy is the hostages --- if the attack succeeds.
Ofcourse, it goes without saying, Hamas ruling class is not same as Hamas cadre. And the element of religiosity generally is not going to lead to a good outcome. Palestinian ruling class (Hamas or even more evil collaborator "Palestinian Authority") is no different than every other ruling class — a force of evil.
But it's an unavoidable fact that when you are systematically denied the tools of self-defence, when you are occupied, some of the ruling class gangsters within these political formation will be forced to fight an evil bigger than them & that's exactly what Hamas action amounts to.
Hamas is like those men who preach & fight for equality in society, while they still practice/benefit from the system of domination inside the house that patriarchy grants them. It doesn't mean those external actions of these men don't have any merit, nor are they clean. Even they are as powerless in the relationship they have with Israel, so they have the legitimacy to fight back, tho they are a ruling class faction.
Hamas will need to be resisted but primarily by Palestinians if & when they acquire the collective power to resist both Israel & Hamas. Based on reality on ground, this is impossible as of now. So, some of the options Palestinians considered legitimate for their emancipation is fight with everything you got (which includes Hamas) & try to see how one can destroy the ruling class enemy within i.e Hamas, which I believe is the story of many 3rd world "nations" that are created since WW2. Maybe there are other paths, which I am sure people would point them out if & when they open up.
Till then, real-world is no Hollywood fantasy story. There are no clean hands in history that made actual impact against a foe with disproportionate violence at his disposal. Only Trial & Error, often taking most bloodiest of forms.