The stabbing attack at a school in western Sweden that left three people dead, including the assailant, is being investigated as a hate crime, police said.
The student and teacher killed in Trollhattan on Thursday were both of foreign origin, as were the two injured who survived the attack.
"We are convinced that the culprit was driven by racist motives," officer Niklas Hallgren told Swedish Radio, citing the selection of victims and findings made in the attacker's apartment.
The attack, the first deadly assault on a Swedish school since 1961, has stunned the country which is currently engaged in intense debate over immigration.
The attacker, identified as 21-year-old Anton Lundin Pettersson, was previously unknown to police. Swedish media, after scrutinising his social media accounts, said he had supported a call to stop immigration to Sweden and "liked" pages hailing Adolf Hitler.
The Kronan school, with students aged 7 to 15, is located in an area with many newly arrived immigrants.
'Black day for Sweden'
Dressed in black and wearing a mask, Lundin Pettersson knocked on the doors of two classrooms and slashed those who opened them with a sword, authorities said.
Swedish media posted pictures of him posing with students who initially thought he was part of some kind of Halloween prank.
After being called to the scene, officers fired two shots, hitting the attacker with a bullet in the lower chest. He later died in hospital.
RELATED: Sweden - Doubling the number of refugees as centres burn
"This is a black day for Sweden," Prime Minister Stefan Lofven said of the attack. "It is a tragedy that hits the entire country."
There has been a recent spate of arson attacks on asylum centres in the south of Sweden as the influx of refugees has surged. Immigration officials estimate that about 190,000 will arrive this year, second only to Germany in western Europe.
Source: Al Jazeera