A 13-year-old boy armed with a crossbow and knife killed a teacher and wounded four others at his school in Barcelona on Monday before being subdued, police and witnesses said.
It is the first documented case of a murder of a teacher at a school in Spain since the country returned to democracy after the death of longtime dictator General Francisco Franco in 1975, according to Spain's ANPE teachers' union.
The attack, which took place just after the start of classes, sowed panic at the Joan Fuster secondary school, which has about 500 students and 40 teachers.
"There were screams from another classroom, the teacher went out into the hall. We heard a really loud noise, we looked into the hall and saw the teacher laying on the ground," said Maria Camila Ospina, a 13-year-old pupil.
"We hid behind desks and chairs and the boy entered the classroom, he looked for a classmate and stabbed him in the thorax and went out into the hall again," she told AFP.
The boy had a crossbow and a knife, she said, adding that students piled desks and chairs against the door of the classroom and only ran out to the courtyard once the attacker was far away.
Police did not say which weapon killed the teacher, but sources close to the investigation confirmed the boy was found with a knife and a crossbow.
The motive is unclear for the attack, which comes on the 16th anniversary of the 1999 Columbine High School massacre in the United States when two teenagers shot a teacher and 12 classmates to death before committing suicide.
Several students said the slain teacher was a substitute who taught social sciences at the school, which is in a middle class neighbourhood of Spain's second-largest city.
Police said the lives of four other people injured in the attack, two teachers and two students, were not in danger. Among the injured is a Spanish language teacher and her daughter who also is a student at the school, according to Spanish media reports.
- 'Liked everything military' -
According to Spanish media, the boy had spoken of killing all his teachers last week, and had a list of names, but his classmates had dismissed his comments as a joke.
"If you knew the boy, you wouldn't be able to imagine that he could do something like this. The only strange thing about him is that he liked everything related to the military, the army, weapons. He would even come to school wearing military fatigue pants," said Camila Ospina.
Prime Minister Mariano Rajoy said he was "shocked" by the attack while Education Minister Jose Ignacio Wert sent a message to the teacher's family and the school director expressing his "deep regret".
Barcelona mayor Xavier Trias said in a Twitter message he was "appalled" by the incident, and vowed his support for all affected.
Police and medics rushed to the scene and the boy was taken to a hospital where he was examined by the psychiatric unit.
Under Spanish law children below the age of 14 are not held legally responsible for crimes and cannot be jailed, although they can be sent to mental institutions.
Prosecutors said the boy will likely be turned over to regional child protection services.