Murder and violence generally is all about de-personalisation. It's not seeing the victim as a person for whatever reason and thus not triggering all of the usual emotional things inside us that prevent us from harming and killing. We are all capable of sociopathic behaviour to some degree and it can be "taught". We make up all sorts of reasons in our heads or others tell us, that this group of people/ individual does not count for X reason.It may be religious, class, moral or any other reason, but all that it requires is that you suspend any empathy with the person concerned and place them apart from the way you judge the rest of humanity.
It's a very frightening subject that people can so easily be led by themselevs and others to commit atrocious crimes, but that is the basic mechanics of it.