A young man planned a killing spree at a school in Austria but aborted it after injuring one pupil, prosecutors said on Friday.

This comes one day after Police in neighbouring Switzerland thwarted a potential school shooting.

The 18-year-old Austrian opened fired at a 19-year-old pupil with a shotgun in front of a school in Mistelbach in Eastern Austria on Wednesday.

The pupil was slightly injured.

The suspect then ran away because his gun jammed, prosecutor Friedrich Koehl, told dpa.

The suspect later surrendered to the Police.

He told investigators that he had planned a killing spree, Koehl said.

READ: Landlord's Children Beat Up Couple Over Rent

Prosecutors are investigating the young man for attempted murder.

The suspect had previously briefly attended the school, Koehl said, but did not confirm media reports that the rampage was meant as revenge against former classmates.

“There is currently no indication that he had accomplices.

“A racist or extremist background can be ruled out, based on current findings,’’ the Police authority of Lower Austria province said in a statement.

On Thursday, Swiss Police detained a 19-year-old man at his home in the region of Bellinzona in the south of the country after he had threatened to kill people at a school.

Police found several guns in his home, authorities in the Ticino region said.

The operation was carried out by a police unit that was formed in 2017 to find dangerous persons to prevent mass violence. 

WATCH: Nigerians speak about Buhari's second term plan