A 21-year-old man walked into a school in Trollhättan in western Sweden on Thursday. He was wearing a helmet, a Star Wars mask and wielded a sword. A teacher, a pupil and the man with the sword were left dead after a rampage. Swedish police said that the suspect, named as Anton Lundin Pettersson, had “racist motives”.

In 2011 I came face to face with Anders Behring Breivik on Utøya island in Norway as he carried out his atrocious massacre. He pointed his gun and fired at me but missed. I survived and later testified against him in court. What we’re now seeing in Sweden resonates heavily with me. In moving on from the Breivik trauma, and since becoming involved in working against violent extremism, I have come to understand violent extremists as individuals capable of change.

In the wake of the Oregon school shooting and other massacres in the US, the question arises as to what drives such perpetrators – usually young, white men – to carry out acts that seem unfathomable to most of us. This is all the more pertinent in Sweden, where the last school attack took place in 1961. But the reality is that violence can be rationalised and carried out by an entirely ordinary person, living in ordinary circumstances in a relatively peaceful Scandinavian country. In 2011 this was underlined by Breivik’s act of terror in Norway. He was later ruled by a Norwegian court to be entirely sane.

The idea that violence can be rationalised by seemingly ordinary individuals might leave us scared and hopeless. But if people don’t need to be deeply mentally disturbed to contemplate horrific acts, then we can at least reach them. There will be opportunities to change their minds, influence their behaviour, alter their decision-making process.

In seeking an understanding of what drove Pettersson, some have turned to reports that he “liked” YouTube videos by neo-fascist bloggers and videos glorifying Nazis. He is also said to have followed online content demeaning women, the religious and the overweight. Through studies of the suspect’s online life, we get an impression of a young, angry man, whose hatreds fed his own feelings of supremacy.

It is likely that Pettersson was influenced by other school shootings inspired by hate. But his act of violence also appears to have been motivated by a highly personalised worldview that was different from that of school shooters Chris Harper and the Sandy Hook elementary school killer, Adam Lanza. The Swede was seemingly not a far-right ideologue like Breivik or Dylann Roof, the Charleston gunman, but perhaps somebody who decided he had to act out against one of his many enemies in order to feel powerful.

We know “normal” people can be drawn to extremism and violence, but also that normal people can help bring others out of extremism. One example is Arno Michaelis, a former neo-Nazi who was deeply involved in the white power movement, and who was first shaken from those views by a black woman at a McDonald’s cash register who met his hatred with unconditional kindness.

People stand by candles and flowers outside the Kronan school in Trollhättan. Photograph: Jonathan Nackstrand/AFP/Getty Images

Another example is the late Johnny Lee Clary, a former Ku Klux Klan leader. Clary was invited on to Oklahoma radio to debate with Rev Wade Watts of the National Association for the Advancement of Colored People; he abused Watts and attempted to intimidate him. Clary explained later in a YouTube video how a black man’s kindness and forgiveness defeated his hate. Pettersson “liked” this video two years ago.

How could someone approve of this video and still go on to become a murderer motivated by the kind of hate Clary deplored in it? Would watching such testimony make an extremist think twice about carrying out an attack?

We’re missing a trick when it comes to those carrying out violent acts. Communities touched by violence have an understandable and overwhelming tendency to scrutinise the ways in which extremists, both those we consider “disturbed” and those we consider “ordinary”, are lured into violence. But rather than trying to pathologise the individual or the process that led him there, we should shift the focus instead towards what opportunities are available to us to prevent him resorting to violence in the first place.

In a young extremist’s daily life, in their school, among their family or friends, were there openings, moments when they could have been led to change?

Hateful people have the ability to take charge of their own lives. If we deny this is possible, we stop it from happening. If we see violence as contagious, we can view Pettersson’s act as the latest in an epidemic of young men who are not necessarily deeply disturbed, but rationalise their own violence and are inspired by others across the world. But if we did more to anticipate and intervene before such individuals erupt, then there is potential to stop ordinary people from becoming murderers.

Rather than looking for the moment they “snapped”, we should be looking for the missed opportunities in the ways our societies handle them: the many moments when we could have changed their perceptions and steered them away from violence. We need to ensure that similar opportunities aren’t missed with others.