The question of why some people do evil things has been the subject of moral philosophers, novelists, and others throughout history. Most recently, it is explored in the movie, The Dark Knight, which examines the motives of The Joker, its villain, but also the dangers of its hero, Batman, becoming a villain himself in the course of fighting villainy. It makes a good morality play and is worth seeing for that reason.
It is not just a lack of empathy. Sociopaths are characterized by the lack of empathy or conscience, but not all of them resort to crime or terror or become tyrants. Most people have limited empathy for people they don't know.
In my own informal discussions with criminals and criminologists, one thing emerges. Most crime and violence is motivated by the thrill of exercising power over others, by destroying their lives, their dreams, by causing them pain. Leaving aside crimes like "mercy killing", one finds that thrill factor predominates, which can overcome empathy or the fear of harming others that prevails in most normal people.
The key, therefore, is to achieve and maintain a civic culture in which children are brought up to fear harming others and never experience a thrill from exercising power other others. Most cultures do that for some others, but not all others, and therein lies the problem. A culture that condones harming some others, whether they are called "infidels", "those kind", or whatever, is pathological, and needs to be treated as such. Ironically, one may have to do so by condoning destroying the intolerant or intolerant cultures, and thereby become an intolerant culture. That is the risk of becoming the enemy we fight.