A masked man who killed a teacher and a pupil at a school in Sweden had "racist motives", police believe.
Police chief Niclas Hallgren said they had based their conclusion on what was found at the killer's apartment and "his behaviour during the act".
Media reports suggest the 21-year-old attacker had far-right sympathies.
Armed with a sword and wearing a helmet and mask, he stormed a school in Trollhattan, near Gothenburg, before being shot dead by police.
Police found a suicide note revealing that the attacker had meant to target "foreigners" and believed "Sweden should not take in so many immigrants", Swedish TV reported.
But investigators believe he acted alone and there was no indication of any group involvement, Aftonbladet newspaper reports.
"He marches through the corridor with his weapons - a large sword and a large, sharp knife. He chose his victims. Those with dark-skin were attacked. He met with lighter-skinned people who were not attacked," police investigator Thord Heraldsson told Aftonbladet.
The helmet he wore was similar to German World War Two soldiers' helmets.
He posed for a photograph with students, who thought he was dressed for Halloween, before going from classroom to classroom at the Kronan School.
A teacher and 17-year-old boy died from stab wounds, while another male student, aged 15, and a 41-year-old teacher remain in a serious condition in hospital.
One of the victims has been identified in media reports as Lavin Eskandar, an assistant teacher. He is said to have died trying to protect schoolchildren.
The attacker's name has not yet been released by police, though they say he was local to Trollhattan. He did not have a criminal record, police say.
The Swedish daily Expressen and other Swedish media named him as Anton Lundin Pettersson, aged 21.
He had allegedly joined a campaign to push for a referendum on whether Sweden should continue accepting migrants.
Media reports said the suspect's accounts on Facebook and YouTube suggest he had an interest in Hitler and Nazi Germany, as well as hostility to Islam and immigration.
"He was a loner. He played video games, lived in his own world," a former classmate told Expressen.
Background: Tom Spender, BBC News
The febrile debate about refugees - in mainstream politics as well as online - is probably what pushed 21-year-old Anton Lundin Pettersson to launch his attack, academics say.
"This is not a person without psychological problems," said Professor Jerzy Sarnecki from Stockholm University. "But he has been inspired by the discourse we have in this country now."
Sweden expects to receive 190,000 asylum applications this year, one of the highest rates per capita in Europe.
Support for the Sweden Democrats party - which is critical of Islam and immigration - has risen.
"Sweden as we know it will not survive the influx of refugees, that is what the party is saying," said Prof Sarnecki.
However Professor Jonas Hinnfors of Gothenburg University insists the deeper trend shows growing support for immigration.
Up to 40% of Swedes want fewer migrants today, down from 65% in the 1990s, he said.
"Public opinion has become drastically more open," he said. "And that is not going to change."
Sweden has reacted with shock to the killings. Before visiting the scene of the attack, Swedish Prime Minister Stefan Lofven said it was a "black day" for the country.
"School is supposed to be the place for learning, play and curiosity and friendship and therefore this is a tragedy that affects the whole country," Mr Lofven told reporters.
King Carl Gustaf said he was "in shock" and that he had learned of the events in Trollhattan "with great dismay and sorrow".
Dozens of people gathered outside the school building on Thursday evening to pay their respects to the victims and place flowers and candles on the ground.
Some residents of the town who were holding a vigil held up posters that read: "Why kill?"
Eyewitnesses described scenes of chaos, with the attacker knocking on the doors of at least two classrooms and attacking two male students who opened them. One of the boys later succumbed to his injuries.
Laith Alazze, 14, told Sweden's TV4 that one of his friends walked over to the assailant to challenge him "but when we saw he stabbed [the teacher], we ran away''.
Another student told the same station that the attacker, who along with the mask was clad in black, "walked sort of like a soldier with a sword in his hand".
Police were alerted to the attack at about 10:10 local time (08:10 GMT) on Thursday, and later gunned down the attacker in the hallway outside a classroom.
The Kronan school has about 400 students aged between six and 15, including many children of immigrants.
Trollhattan is an industrial town in west Sweden, located about 75km (50 miles) north of Gothenburg, the nation's second largest city.
School attacks are rare in Sweden - with just one incident on record in the past 20 years, in which one pupil was shot dead.