Provide a high enough standard of living that extremism costs an individual too much to engage in. This may sound a bit dystopian but a fat and happy populace is much easier to govern than a starving and desperate one.
Also, education - not like nationalistic bullshit education but a general education that leads people to nuture their empathy and social awareness. When people see desperate situations and no effort to address them they're more likely to turn to extremism then if they're aware of an effort (even if it's ineffective) because if there's an effort ongoing the politically active will be more likely to join the effort rather than fighting the establishment.
Lastly, a non-shitty election system that makes everyone (not just swing state voters) feel like their voice is being heard. If you don't think you'll be able to effect change within the system you're more likely to turn to extremism.
It is not bad per se. It should be the goal of every government to make all people fat and happy.
The problem is, it is enough to only make >50% happy.
Depends on the root cause. If the terrorism comes from a place of desperation for liberation or emancipation, addressing the underlying material conditions would prevent that kind of terrorism. A great example of that is Apartheid South Africa and Ireland. On the other hand, if the terrorism comes from a place of Fascism, like ISIS or the KKK, I think funding progressive and democratic opposition and also education would have the most positive effect. Holding the terrorists responsible for their actions and jailing them accordingly is really important, but to solve the underlying cause is critical to end it entirely. Otherwise, if the root cause isn't addressed, there is no reason to believe the terrorism will stop.
Admittedly, I don't know much about the details of the history of ISIS. But from what I understand I agree, the material conditions that resulted from the US's invasion of Iraq was a major significant factor in the rise of ISIS
Ireland is still a work in progress and can regress at any time. The material conditions haven't all been addressed. There's still a supremacist culture with a settler colonial mindset that remains. There's currently a liberal solution of appeasement in place, we are constantly bombarded with demands for more concessions from the conservative mainstream media in Ireland.
Surveil everything at all times. Surveillance Fog, which consists of nanobots that can detect terrorist activity such as using machine tools, holding sharp edged objects, or making eye contact with another person. Revoke all rights, and make sure nobody speaks about rights.
Also, for safety, encase all people in hard foam with catheters to provide nutrients and waste removal.
Monitor mental activity for signs of deviation. Correct outlier thinking at the synaptic level.
With these modest steps, terrorism can be fully eliminated, and our civilization can finally be Free From Evil.
Terrorism is an inchoate concept. History is written by the victors. American terrorists dumped tea in Boston Harbor, but they were freedom fighters and revolutionaries because they prevailed. On the flip side, Israel killed a terrorist. How do I know they were a terrorist? Because Israel wouldn't have killed them otherwise.
Overall, other responders have good answers - equal rights, freedoms, and opportunities. Plenty of bread and circuses. I can't be motivated to be a terrorist because I would sacrifice too much changing the status quo.
Outside, they do organizer's targeted drones strikes, special force operation against terrorism. Pretty sure it's a documented fact.
Inside? I am naive enough to believe that they don't beside some leeway from the prosecution when elite cops involved in counter terrorism shoot someone
I'm surprised no nation has set up surveillance traps for susceptible firearm salespeople to fall for so every purchase can lead right back to the buyer.