The answer? It doesn't!
Sheikh Salah Shehada , the first general leader of Al-Qassam Brigades , was asked "What is the criteria of a selecting any target? And what do you say about killing civilians?"
He replied " We do not deliberately target children, the elderly or houses of worship despite them being houses that teach hatred against Muslims. We do not target schools and do not order the killing of children. We do not target hospitals although they are easy targets for us. We do not fight Jews because they are Jews. We fight them because they occupy our land. We don’t fight them for their faith but for taking our land. And if children fall during operations, it is beyond our control.
I leave it as an exercise for the reader to see if Hamas ever targeted civilians.