Hamas is firing rockets to areas from which Palestinians have violently ethnically cleansed since 1947. (Read Ilan Pappe, Benny Morris and other Israeli New Historians for documentation.)
That's before Israel was created! It was this Ethnic cleansing, such as the massacre of 200 civilians in the Arab village of Deir Yassin by Jewish terrorists (April 1948) that prompted the Arab States to intervene (May 1948) to save Palestinians.
Israeli forces even murdered a Swedish UN diplomat, Folke Bernadotte, in September 1948. He was trying to get a cease fire that would stop the ethnic cleansing.
Under International Law, Israel is committing War Crimes by refusing to let the Palestinian refugees return and by settling Jewish refugees in Arab homes. The deaths of Israeli civilians are thus the result of the Israeli War Crime of settling civilians of the occupying power on occupied land.
Israel is responsible for its civilian deaths by encouraging its civilians to break International Law.
To Illustrate: You enter and take half of someone's house without their permission and the homeowner fights to get you out. You then bring your kids to live in the two rooms that you illegally occupy. Who is therefore at fault when the homeowner fires shots into those rooms, killing some of your kids?