Police investigator Thord Haraldsson said the killer, identified in Swedish media as Trollhättan native Anton Lundin Pettersson, targeted “those with dark complexions”.
Officers also found documents at his home indicating the attack “was planned, and a hate crime”, he said, adding that the killer left “a type of suicide note” describing his motive.
Wearing black clothes and armed with a sword and large knife, the masked 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 officers shot and killed him, he managed to kill a teacher and critically wound a teenage pupil who later died of his wounds.
Another boy, aged 15, sustained critical stab wounds during the attack along with a teacher who was seriously injured. All those wounded had dark skin, said police.
INTERVIEW: 'My brother died a real, real hero'
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.
But he was also fascinated by films about Nazis, the Third Reich and the Second World War, and on Facebook he 'liked' several debates by Sweden Democrats leader Jimmie Åkesson, 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.
“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 rival tabloid Aftonbladet.
Police and forensic teams at the Trollhättan school on Friday. Photo: Björn Larsson Rosvall/TT
Swedish 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 radicalized 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 the AFP news agency.
The killer had no links to the Kronan school, and no one there seemed to know him. When he arrived, as The Local has previously reported, 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 pupils with “white skin”, but not attacking them.
“We can also see what he did to those with dark complexions,” investigator Thord Haraldsson said.
On Friday, police were still looking for clues at his apartment in Trollhättan, about five kilometres from the school.
IN PICTURES: Swedes mourn Trollhättan school attack victims