A MASKED man wielding what looked like a sword stabbed four people at a school in southern Sweden, killing a teacher and a student before being shot dead by police, authorities said.
One student thought he was playing a Halloween prank.
Students fled from Kronan school in Trollhattan, near Goteborg, Sweden's second-largest city, after the morning attack in a public cafe in the school's lobby, police said. The school has 400 students ranging from pre-school to high school.
Trollhattan, located 350km southwest of Stockholm, is a former industrial city of 56,000 people with a large immigrant community.
Police arrived at the school to find one male teacher already dead and three other people seriously wounded - two boys aged 11 and 15 and another male teacher, police spokesman Thomas Fuxborg told The Associated Press.
Police fired two shots, one of which hit the attacker, he said.
One student and the attacker died later at the hospital, authorities said.
The attacker, a 21-year-old from Trollhattan, knocked on the doors to two classrooms and stabbed those who opened them, police spokesman Thord Haraldsson told reporters at a press conference. Police searched the attacker's home and found "interesting" things for their investigation, he added, without elaborating.
Laith Alazze, a 14 year-old student at Kronan, said at first he thought the attacker - who was clad in black and wearing a helmet that masked his eyes - had something to do with Halloween.
"One of my friends walked over to him to challenge him, but when we saw he stabbed him (the teacher), we ran away," Alazze told Sweden's TV4.
Images show the man wearing a Nazi soldier-like helmet and a mask that many thought was from Star Wars. Witnesses said he posed for pictures with students, who thought he was part of a Halloween prank. Police said he had more than one weapon, including "at least one knife-like object".
The attacker had a gunshot wound to his lower chest and died later at the hospital, officials said. Police spokeswoman Maria Randsalu said the second victim was a student, but did not say which one.
The three wounded, all in serious condition, underwent surgery at the Norra Alvsborgs Lanssjukhus hospital. Dr. Lars Spetz told reporters the teacher had been stabbed in the abdomen while the two students were stabbed in the abdomen, liver and chest. "They hover between life and death," Spetz said.
Swedish media said the school held a meeting to discuss teachers' fears that they could not control access to the school. Students must go through the public cafe to reach the school's cafeteria and other parts of the building.
A sober-looking Swedish Prime Minister Stefan Lofven called the deadly stabbing attack "a tragedy that hits the entire country." He spoke outside the school in Trollhattan after viewing the lobby where the attack began.
Lofven declined to comment on Swedish press reports that the attacker had right-wing sympathies, saying police were still trying to establish a profile of him.
"My thoughts go out to the victims and their families, the students and staff, and the whole community," Lofven said earlier. "No words can describe what they are going through right now."
King Carl XVI Gustaf said Sweden was "in shock" following the attack and that the royal family received the news "with great dismay and sadness."
Update your news preferences and get the latest news delivered to your inbox.