German authorities have arrested a 15-year-old boy who they suspect of having planned a rampage and who they also believe was in contact with a teenager who killed nine people in Munich last week.
The boy was arrested on Monday night and subsequently sent to a psychiatric facility, prosecutors and police in Ludwigsburg, near the south-western city of Stuttgart, said.
A witness had told police that he came across an online chat between the suspect and the Munich shooter, who killed himself following his July 22 attack.
He then looked at a social media profile on which the boy had posted photos and drawings that pointed to a possible rampage.
There is no suspicion that the 15-year-old had any knowledge of plans for the Munich attack, police spokesman Peter Widenhorn said.
Police searched the boy's family home and found small-calibre bullets, several knives and daggers, escape plans for his school, chemicals and instructions for making explosives.
In questioning, the 15-year-old said that he had considered carrying out a rampage "against the background of personal and school problems", police and prosecutors said in a statement.
However, he told them that he had since given up on the idea.
Prosecutors ruled out a terrorist motive and said the boy was under investigation for unauthorised possession of weapons and explosives.