I believe there are three areas to work on:
1. Covering narratives and social approval
2. Access to resources
3. Triggering event; moral outrage
There are currently many covering narratives that dehumanize opponents, several come from Islam, others from other religions, more often than not Christianity-related, and several from political ideologies. They share an absolute take on truth, meaning it scales infinitely in the mind when weighing against other explanations or values. Social approval is important, but I'll leave it out for now; pretty obvious. (ETA: Not much to do wrt the mentally unstable except restrict access to firearms.)
Resources are important for the large scale attacks with guns or bombs, which ostensibly is sensitive to some forms of surveillance. The number one resource is information, the how-to's, access to which should be curtailed when legal to do so. Cyberwarfare, passive and active surveillance, border control (non-Trumpian).
There is very little to do about triggering events that tip the hand, such as a friend of the Afghani youth who committed the train stabbings dying back in Afghanistan. As to the moral outrage, if peaking in response to situations, more will decide to carry out attacks. The response here is multifaceted, including not entering into military action needlessly (lesson learned, too late now), proactive outreach to speak about and deal with events, and work on the part of religious and lay people. (I still need to get a handle here and hope to learn more about the dynamics involved).
Moral outrage is also part of the overall alienation, stemming from contrasting social mores. This is going to require a dialog that actually elicits some form of tacit nod that everyone must agree to disagree in some meaningful and repetitive way, such that it becomes cultural DNA. In the very short term, I would like to see all licensed political parties and religious establishments in the EU sign an affidavit swearing conformity with Article 54 of the European Charter on Human Rights.