TROLLHATTAN, Sweden – Hundreds of people lit candles Friday in the yard of a Swedish school where police said a 21-year-old masked man with a sword and a knife went on a rampage a day earlier, stabbing two to death and seriously wounding two others before being shot by police.

Police described the Thursday attack as a carefully organized, racist hate crime by a young man who methodically selected his victims in Trollhattan’s Kronan school, where most of the students are foreign-born.

The Scandinavian nation of 10 million, known for its welcoming attitude toward migrants, was shocked by the violence in the southern industrial town near Sweden’s second largest city, Goteborg.

“This is a black day for Sweden,” Prime Minister Stefan Lofven said of the country’s deadliest school attack. “It is a tragedy that hits the entire country.”

Although violent crime is relatively rare in Sweden, there has been a spate of arson attacks on asylum centres in recent weeks as an influx of refugees has surged. Immigration officials estimate some 190,000 asylum-seekers will arrive this year, second only to Germany in Western Europe.

Nour Shilbaya, an 18-year-old former student at the school, took part in the candlelight vigil.

“I’ve been living here my whole life. It feels so hard to see all of this happening because it feels like a movie,” she said. “You can’t imagine that it is real.”

Handwritten signs in Swedish, Arabic and Persian stuck on windows and doors urged people to respect those who visited to pay their respects throughout the day.

Police investigator Thord Haraldsson told reporters that school surveillance video showed how the attacker roamed through the school with a sword and a sharp knife, selecting victims who were all “dark-skinned.”

Evidence appears to indicate he acted alone, Haraldsson said, adding that police found “a kind of suicide note” in his apartment. They said the assailant had considered the attack his final act.

The sword’s sheath was found inside a car parked near the school, Haraldsson said.

None of the victims has been identified by authorities, but local media cited relatives as saying those who died were 20-year-old Lavin Eskandar, a mentor at the school, and Ahmed Hassan, a 15-year-old student.

Before the candlelight vigil, a few hundred people held an anti-racism protest outside the school, some carrying banners with the words “No to racism, no to hatred” and “Why?”

“We do not have all the facts yet, but we know innocent people have died. Maybe because of the distorted debate in the society,” Imam Abdi Rizak Wabari said during Friday prayers at a nearby mosque.

Once Sweden’s busiest industrial city, a centre for heavy industries and car production, Trollhattan has been struggling with unemployment for years. It now has Sweden’s highest jobless rate — 14.1 per cent in 2014 compared to 8 per cent for the whole country. In addition, the city’s rate of people with higher education is 20.9 per cent, below the national average of 25.1 per cent.

“This is a quiet place. A very nice place to live. It is not a racist place,” said Abdul Asiz Kassim, a 37-year-old Somali translator who came to Sweden 23 years ago. “What happened here yesterday … nobody can stop.

“Just like in Norway with (Anders Behring) Breivik. People get crazy ideas from the Internet,” Kassim said, referring to the anti-Muslim extremist who killed 77 people in a bombing and gun rampage in Norway in 2011.

Surveillance videos authenticated by police show the assailant posed for photos with some students before beginning his deadly rampage. Several students thought the attacker was playing a Halloween prank.

Police said he entered the school through a cafe in its lobby that is open to the public. He stabbed two victims, then knocked on two classroom doors and stabbed two more victims.

Mohammed, who declined to give his last name, recalled how a classmate was stabbed when he opened the door to the attacker, whom he described as a man with “a Star Wars mask and a really big sword.”

“We all still thought it was a joke, Halloween and all. But then he lifted his shirt and his intestines were hanging out,” he told The Associated Press. “That’s when it became serious, we all panicked. We all started screaming.”

Panicked students fled the school as police and ambulances rushed in. Authorities found a dead male teacher and three people seriously wounded — two boys and another male teacher. All the wounded had surgery but one of the students later died.

Hospital officials said that the other wounded student’s condition had improved Friday and was considered stable, while a 41-year-old teacher was in “serious but stable” condition.

Sweden’s last school attack was in 1961, when a 17-year-old opened fire at a school dance in the southwest, wounding seven students, one of whom died later.

____

Jona Kallgren in Trollhattan and Jan M.Olsen in Copenhagen, Denmark, contributed to this reprt.