Let’s assume the guy who ran over 80 people in Nice, France was a suicidal maniac. He was also a Muslim but not a strict practitioner of Islam, for example, he did not frequent a mosque. So what do strict practitioners who spend most of their time at mosques reading and researching Islam do? Well, some of them, some of them, actually lay down the groundwork and literature for terrorism. 
When the supposed madman, who is a Muslim, is overcome with a desire for massacre-suicide, he finds the justification and heavenly reward for his acts of terrorism in the literature written by some of, some of, the Muslims who frequent mosques. 

An ideology that can be embraced and enacted by psychopaths. 

And Allah is merciful, you can repent the sins of a lifetime one day before you die and you’re forgiven, especially if you die gloriously answering Jihad’s call.