All types of immoral acts can be justified and rationalized as soon as people adhere to the ''the end justifies the means'' belief.
It's like all dictators murdering their ways to the top, but in their mind it is all sacrifices to create some utopia.
Also take into account the disease of psychopathy, which the higher you go in society the more prevalent it is (google english ceo psychopathy study). It completly removes the ability of the brain to feel empathy and leaves only the demands of the ego. Basicly they could shoot 100 children and take a nap right after.
If you are interested in information regarding how people are able to blow themselves up for an organization like ISIS I would recommend the following radio broadcasts :
The entire series is really a goldmine of information in my opinion, I highly recommend it if the two above broadcasts turn out to be of interest to you.