Sweden: Mainstream debate 'fuelled Trollhattan attack'
Clad in black, with a Darth Vader-like mask, a Nazi helmet and a sword, Anton Lundin Pettersson marched like a soldier through the school corridors, singling out those with dark skin to attack.
"It's a mixture of craziness and political action," said Professor Jerzy Sarnecki from Stockholm University's Department of Criminology.
"This is not a person without psychological problems. But he has been inspired by the discourse we have in this country now related to the question of refugees and foreigners."
Sweden expects to receive 190,000 asylum applications this year, one of the highest rates per capita in Europe.
Support for the far right has risen as Sweden's ability to house and integrate the new arrivals comes under strain.
Amid the febrile debate, some polls suggest the Sweden Democrats party - which is critical of Islam and immigration and won 13% of the vote in the 2014 election - is now the country's biggest party.
"Sweden as we know it will not survive the influx of refugees, that is what the party is saying," said Prof Sarnecki.
"Anonymous people on the internet say much worse things. They say there is no other way but to kill these people and burn the barracks where they are staying. They will celebrate this guy as someone who has offered his life for the survival of his people."
More than a dozen arson attacks this year have targeted refugee reception centres and homes.
However the Trollhattan attack is the worst thing that could have happened for the Sweden Democrats, Prof Sarnecki said: "It has made them toxic."
The attack has similarities to far right attacks that happened in the 1980s and 1990s, when Sweden was welcoming in refugees from the Bosnian and Iran-Iraq War, according to Professor Jonas Hinnfors, professor of political sciences at Gothenburg University.
But he says the deeper trend is that Swedes have become far more open-minded towards immigration, and he doesn't foresee that changing.
Up to 40% of people want fewer migrants today, down from 65% in the 1990s, he pointed out.
"Public opinion has become drastically more open on issues of race, immigration and people from different cultures. On the other hand, the far right is mobilising - and certain groups may feel their resistance is hardening. Whether one side will have much of an impact on the other in future is hard to say," he said.
Prof Sarnecki agrees that most Swedes are not against the society's rapid transformation from a homogeneous racial group into an ethnically mixed society.
"But a substantial group is against it," he said. "And they are scared to death."