The 13-year-old allegedly used a crossbow to wound several people iStock

A 13-year-old has been arrested in Barcelona for allegedly killing a male teacher and wounding several other people with a crossbow.

The attack took place in the Joan Fuster Institute in the Sant Andreu neighbourhood of the city. A regional police spokesman said the minor was detained on 20 April.

The boy reportedly arrived late to school and shot a female professor after she told him to get inside. Then he fired at another professor - a male teacher who had been there for a month and was helping a class next door - killing him. Four people in total were wounded in the attack.

The rampage echoed the high-school massacre perpetrated in 2003 novel We Need To Talk About Kevin, by Lionel Shriver. The novel was turned into a film in 2011 starring Tilda Swinton.

The pupil is being held within the school building and his motive is not known yet. According to a report on Vanguardia newspaper, the boy was obsessed with the military and had a collection of weapons at home. The 13-year-old allegedly told a classmate he wanted to kill all the teachers at the school and was known to write up blacklists.

Nicolás Fernández, president of Spanish teachers' union Anpe, told The Local website the case was "absolutely new in Spain" and "totally isolated".

Fernández said: "This has to push us to continue to work towards preventing and detecting violence in schools."

The attack was carried out on the 16th anniversary of the massacre at Columbine High School in the US, when two students killed 12 pupils and one teacher.