Police investigator Thord Haraldsson said the killer, identified in the press as Trollhattan native Anton Lundin-Pettersson, targeted "those with dark complexions".
Police also found documents at his home indicating the attack "was planned, and a hate crime," he said, adding that the killer left a "kind of suicide note".
Teacher killed, pupils hurt in sword attack on Sweden school
Wearing black clothes and a Darth Vader-like mask and armed with a sword, the assailant went from classroom-to-classroom in search of victims at Kronan school for children aged between six and 15.
Police believe he picked the school because many of its students are immigrants.
Before police shot and killed him, he managed to kill a teacher and critically wound a teenage student who later died of his wounds.
Another student, aged 15, sustained critical stab wounds during the attack along with a teacher who was seriously injured.
All of those wounded were of immigrant origin, police said.
Although the killer had no criminal record, details emerged in the press suggesting he was a loner who admired Adolf Hitler, Nazi Germany and the far-right Sweden Democrats party, which is critical of Islam and of rising immigration to the Scandinavian country.
On his Facebook and YouTube accounts - now closed down - he comes across as a person who listens to death metal and hard rock bands such as Rammstein and Pain.
He was also talented at lathe-work, competing in the finals of the Swedish youth national championships.
But he was also fascinated by films about Nazis, the Third Reich and World War II, and on Facebook he "liked" several debates by Sweden Democrats leader Jimmie Akesson, as well as anti-immigrant blogger Angry Foreigner and a video called "Nazi Generator 2015", where toy figures are incinerated to the sound of German marching music, recalling Nazi gas chambers.
Despite those views, those who knew him described him as polite and quiet, saying they never would have guessed he would carry out such an attack.
Police indicate 'racist motives' in Sweden sword attack
"He was a loner. He played video games, lived in his own world," a former classmate told the Expressen daily.
"He was always dressed in black, or in camouflage clothes," a friend told Aftonbladet.
Anti-racist magazine Expo said his profile was similar to that of other racist attackers.
"We see the trend in the US of young angry white men who become radicalised on Internet forums. This act could be seen as part of that trend of people who think it is their mission to save the white race," editor-in-chief Daniel Poohl told AFP.
The killer had no links to the Kronan school, and no one there seemed to know him.
When he arrived, some unsuspecting students thought his get-up was a prank or a Halloween costume and even posed with him for pictures.
Police on Friday said video footage from inside the school showed the assailant talking to "fair-skinned" students not attacking them.
"We can also see what he did to those with dark complexions," investigator Thord Haraldsson said.
Around 20 percent of Trollhattan's population of 57,000 are of foreign origin and the school is located in an area which is emblematic of Sweden's failure to integrate its immigrants: an impoverished, segregated neighbourhood with high unemployment, drug problems and poor school performances.
On Friday, police were still looking for clues at his apartment in a middle-class neighbourhood of Trollhattan, about five kilometres (three miles) from the school.
COMMENTS (3)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ