A masked man armed with a sword posing for a photo before attacking students and staff at the primary and middle school in Trollhattan, southwestern Sweden, on October 22, 2015
Trollhättan (Sweden) (AFP) - A masked man brandishing a sword and reported to have far-right sympathies killed a teacher and a student and seriously wounded two other people at a school in Sweden Thursday before police shot and killed him.
Pictures taken by students and circulating in the media showed the assailant wearing black clothes and a Darth Vader-like mask, with school children initially thinking it was a prank or a Halloween costume.
Media reports identified the attacker as Anton Lundin Pettersson, describing him as a quiet 21-year-old opposed to Islam and immigration.
"He was a loner. He played video games, lived in his own world," a former classmate told daily Expressen.
The attacker, who went from classroom to classroom at the school for six to 15-year-olds, including many newly-arrived immigrants, in the southwestern town of Trollhattan.
The attack shocked a nation where such violence is rare.
One teacher was found dead at the school -- described in the media as a "problem school" -- while a young male student and the assailant both died in hospital several hours later.
"The assailant knocked on two classroom doors and he attacked the two students who opened the doors," police investigator Thord Haraldsson said.
Hospital staff had previously confirmed that two boys, aged 11 and 15, were in critical condition with stab wounds, while another teacher who was seriously wounded in the attack also underwent surgery.
The assailant was from Trollhattan.
Police have not disclosed his identity nor given any further information about him or the possible motive for the attack.
He did not have a criminal record and was not known to police, said law enforcement officials as police searched his home for clues.
However, Swedish news agency TT and daily Expressen reported that he had a YouTube account where he posted material glorifying Hitler and Nazi Germany and critical of Islam and immigration to Sweden.
The anti-racism magazine Expo meanwhile reported that its police sources said they were investigating a "political motive".
Police were alerted to the attack at 10:10 am (0810 GMT).
"When we first saw him, we thought it was a joke. He was wearing a mask and black clothes and (carrying) a long sword. Some students wanted to take their picture with him and feel the sword," one student identified only as Laith told Swedish television SVT.
When the man started attacking people, he quickly realised it wasn't a joke and fled as the assailant went from classroom to classroom looking for victims.
Another student, 14-year-old David Issa, told AFP he was sitting in the school's cafe when he saw the attacker approach.
- 'Should never happen' -
"We were sitting in the (school's) cafe and then this guy came up who was wearing a mask and carrying a sword and he stabbed my teacher. I panicked and ran away," he said.
"Then the police came. And he started stabbing others in the classrooms, banging on the classrooms and stabbing people in there," he said.
Aster Caridad, a 15-year-old student at the school, said one of the two wounded students was her friend.
"The teacher ordered us not to leave the classroom as someone was murdered and others (were) injured," she said.
"I never expected or even imagined this could happen in my school," she added.
The Kronan school has around 400 pupils, and Swedish media described it as a "problem school".
It had been criticised by the Swedish Schools Inspectorate for its lax security and on account of a number of disruptions which prevented the pupils from learning.
Teachers had complained to the inspectorate about the school library and cafe being open to the public and creating an insecure environment for the children, Swedish news agency TT reported.
Swedish Prime Minister Stefan Lofven visited the town after the attack.
"What should never happen happened here today," he told reporters, adding that he wanted all children to know that "I will do everything in my power to make sure you feel safe in school."
Crisis teams were at the school assisting parents and students.
- 'Lock the door' -
But some parents outside the school were unhappy at the way it handled the attack.
"No one from the school called me. I found out what happened from a neighbour when I was carrying out the trash. I got into my car and came here," one father told TT after being reunited with his young daughter.
The girl, who was identified only as Emilia, said the headteacher had come into her classroom and told them to stay inside and lock the door.
"We didn't know what was happening," she said.
Trollhattan is an industrial town of 57,000 and home to the former Swedish carmaker Saab which filed for bankruptcy in 2012.
School attacks are rare in normally tranquil Sweden.
A 1961 school shooting in Kungalv, in southwestern Sweden, left one person dead and six others injured.
No other mass shootings have occurred since then, though at least one attack has been foiled, in the southern city of Malmo in 2004. Other threats have been issued but not followed through.