Police officials said Friday there might have been a racist motive behind the attack on a school in Sweden, the Associated Press reported (AP). The attacker had stabbed two people to death on Thursday, before he was shot dead by police in the industrial town of Trollhättan in Västra Götaland County in western Sweden.

Officials said, according to the AP, that they concluded the attack was a hate crime based on discoveries made after searching the attacker’s home, the way he dressed, how he behaved at the site and the pattern in which he selected his victims. Police officials believe that the 21-year-old masked perpetrator made his way into the school through a café in the lobby that is open to public. He reportedly knocked on the doors of two classrooms and then stabbed his victims.

"All together, this gives a picture that the perpetrator had a racist motive when he committed the crimes at Kronan school," police officials said in a statement, according to the AP.

Local media reports claim that the assailant had posed with students for photos before he began his deadly rampage in the halls of Kronan school. The town, Trollhättan, is said to be home to a large immigrant community and majority of the students studying at the school are foreign-born, the AP reported. Students, who witnessed the attack, had initially thought it was a Halloween prank.

Local media outlets had also posted a photo of the attacker, clad in black with a military-style helmet, a mask and a sword in his hand. He later died due to his wounds from being shot by the police.

"This is a black day for Sweden," Prime Minister Stefan Lofven said Thursday, referring to the attack as the deadliest ever against a school in the country, according to the AP, adding: "It is a tragedy that hits the entire country."

Two boys, aged 11 and 15, and a 41-year-old teacher, were severely injured in the attack while another male teacher was found dead. The 11-year-old student later died due to his wounds, while the 15-year-old's condition was considered stable. The injured teacher was in a "serious but stable" condition, the AP reported. None of the victims or the attacker has been identified.

Sweden is known for relatively less violent crimes despite a recent rise in arson attacks on asylum centers in the southern part of the country. Authorities expect Sweden to witness an influx of 190,000 refugees this year, second only to Germany in Western Europe.