By Mai Yaghi
A masked man brandishing a sword and reported to have far-right sympathies killed a teacher and a student at a school in Sweden before police shot and killed him.
He also seriously wounded two other people.
Pictures taken by students and circulating in the media showed the assailant wearing black clothes and a Darth Vader-like mask, with schoolchildren 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 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 on Thursday (local time) shocked a nation where such violence is rare.
One teacher was found dead at the 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 its police sources said they were investigating a "political motive".
Police were alerted to the attack at 10:10am on Thursday.
"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, said he was sitting in the school's cafe when he saw the attacker approach.
"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.
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 a number of disruptions which prevented the pupils from learning.
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.