An 18-year-old man armed with a sword carried out the attack at the Brinell School in Fagersta, northwest of Stockholm.