German prosecutors on Tuesday said they had charged a 17-year-old boy with allegedly planning a May school bomb attack that was only narrowly avoided when he was arrested the day before.
The suspect, named as Jeremy R., planned the "right-wing extremist motivated attack" on a school he attended in the city of Essen using explosives and various other weapons, federal prosecutors said in a statement.
"Teachers and a larger number of pupils were to be killed" in the massacre planned for May 13, they said.
Jeremy R., who was 16 at the time of his arrest, had allegedly acquired the necessary materials to assemble pipe bombs and obtained information on the internet about how to build them.
He had also assembled weapons including knives, brass knuckles, machetes, crossbows and arrows as well as firearms, the prosecutors said.
Police in Essen stormed the teen's room overnight on May 12, uncovering anti-Semitic and anti-Muslim materials as well as his own writings which suggested he was suffering from serious psychiatric problems.
Investigators at the time said they had been tipped off by another teen who informed them that the young man "wanted to place bombs in his school", located about 800 metres from his home.
School massacres are relatively rare in Germany, which has some of the strictest gun laws in Europe.
But a recent spate of incidents has rattled the country.
A few days after Jeremy R. was arrested, a 21-year-old gunman opened fire at a secondary school in northern Germany, badly injuring a female member of staff before being arrested.
In January, an 18-year-old student opened fire in a lecture hall at Heidelberg University in southwestern Germany, killing a young woman and injuring three others before fleeing the scene and turning the weapon on himself.