It is really not that difficult.
Nuance: noun; a subtle difference in or shade of meaning, expression, or sound.
Hamas is a terrorist group. They have committed many terrorist acts. Israel is not a terrorist group, but they ARE an apartheid state committing war crimes and acts of terror for decades, and genocide right now in November 2023.
Hamas rose as a response to the decades of terror and war crimes committed by Israel. Israel was created due to the West's not responding sooner to the ethnic cleansing and then genocide in Germany in the 1930s.
The Palestinians had nothing to do with Germany's horrific actions in the 1930s. They were however, bearing the brunt of British and then American geopolitical plans for the Mid-East starting in the early part of the 20th century.
The UN supported ethnic cleansing of Palestinians starting in 1948 and continuing to this day. That same UN resolution to create Israel was supposed to also create Palestine. That didn't happen and the ethnic cleansing continued apace. WHY Palestine was not formed is also nuanced and not black and white.
Due to this Some Palestinians feel that Israel is not a legitimate country. There is some justification for that belief, as the "British Mandate" was just a nice way of saying "our Empire will kill you if you don't do what we say." Again - nuanced.
After about 70 years of ethnic cleansing of Palestinians, the Nakba and then another 35 years of increased ethnic cleansing and war crimes, some Palestinians had become very radicalized. It happens in every area where a group is occupied and oppressed. Very ironically, the Jews in the Warsaw Ghetto saw their situation very much like many Palestinians in Gaza today.
That was the background to Hama's founding in 88. Another nearly 30 years later, it has become clear that barring another Jewish genocide/WW, Israel is here to stay. Which is one of the reasons why Hamas DID soften its tone on Israel. Here from the VERY pro-West Guardian from 2017.
https://www.theguardian.com/world/2017/may/01/hamas-new-charter-palestine-israel-1967-borders
This is a long, nuanced way to get to you second to last sentence. It is disingenuous at best and cynically manipulative justification for war crimes and genocide at worst to start any conversation about the situation in Gaza with October 7, 2023. I've just laid out a VERY abridged history going back well over 100 years of the situation there.
There is no answer to your last question, because "the words of the prophet" are also nuanced. Every holy book has passages that are a message of peace, and others are calls to war. These books are also all over a thousand years old and none of us living today are native speakers of the languages they were written in, and literally only a handful of people are reading these books in their native languages. Language is FULL of nuance, so the "word of the prophet" does NOT have a universally accepted definition.
Finally, I don't believe Hamas, the Israeli government or any group with significant power gives a rat's ass about religion per se. They all use religion as a tool to manipulate public opinion to do what will get them more power or keep them in power. See Trump and "two Corinthians."
TL;DR: No situation in real life is totally black and white. No person or group is 100% bad and no person or group is 100% good. Meaning that no "100% good vs. 100% evil, there is no nuance" situation exists. That is VERY much the case in Gaza.