The two victims, both women in their 50s, were teachers at Malmo Latin, a large high school in Sweden’s third-biggest city, police said at a press conference on Tuesday.
Media reports said the suspect, whose name has not been disclosed, was armed with a knife and an axe, though police have not confirmed that information.
Police chief Petra Stenkula said police had seized “several weapons that are not firearms” at the scene.
Investigators were now trying to determine whether the suspect specifically targetted his victims or chose them at random, and whether he had planned to attack more people.
“We don’t know yet if he had any connection to these employees”, Stenkula told reporters.
The student “has no criminal record”, she said, adding that police were looking into his background and movements prior to the attack. Investigators were on Tuesday searching the suspect’s home in the nearby town of Trelleborg, she added.
Police were alerted to the attack at 5:12 pm and a first patrol was able to enter the school minutes later. About 50 students and teachers were inside at the time, and news footage showed heavily equipped and armed police inspecting the interior of the building.
The suspect was arrested on the third floor just 10 minutes after the first alert, putting up no resistance, Stenkula said. His two victims were lying on the floor nearby, she added. The teachers were rushed to hospital for treatment but their deaths were announced later in the evening.
According to daily Aftonbladet, the alleged attacker called emergency services to say where he was and that he had laid down his weapons, and confessed to the killings.
Swedish Prime Minister Magdalena Andersson on Tuesday expressed her “sadness” and “consternation” over the attack.
At the high school, which was closed on Tuesday, a support group has been set up for teachers and students, local authorities said.
“Everyone is deeply shocked. Devastated,” a teacher at the school who didn’t want to be identified told AFP on Tuesday.
“It’s an awful crime, it’s impossible to take it all in”, she said, standing outside the school where a group of about 20 students stood hugging and crying, some with flowers to lay down on the ground.
School attacks are relatively rare in Sweden, which has in recent years grown more accustomed to shootings and bombings in underworld settlings of scores that kill dozens of people each year.
But several serious incidents have taken place at schools in southern Sweden in recent months.
In January, a 16-year-old was arrested after wounding another student and a teacher with a knife at a school in the small town of Kristianstad.
That incident was linked to a similar knife attack in August 2021 in the town of Eslov, about 50 kilometres (30 miles) away, when a student attacked a 45-year-old school employee.
No link has been established between those two events and the Malmo attack.