German police arrested a 19-year-old Syrian suspected of planning an Islamist-motivated bomb attack in Germany with the aim of killing as many people as possible, the federal prosecutor's office said on Tuesday.
Interior Minister Thomas de Maiziere said security officials had averted a "major terrorist attack".
The man, identified as Yamen A., had been in contact online with jihadists including one who described himself as a "soldier of the caliphate", a spokeswoman for the federal prosecutor's office said.
Yamen A. was arrested in the early hours in the northeastern town of Schwerin. Police searched his home and also those of other people not suspected of being directly involved.
"According to the findings so far, Yamen A. made the decision no later than July 2017 to detonate an explosive device in Germany in order to kill and injure as many people as possible," the prosecutor's office said in a statement.
"As a result, he began to procure components and chemicals needed to make an explosive device. Whether the suspect had already envisaged a specific target for his bomb attack is still unclear," the office added.
He had ordered chemicals over the internet that could be used to make the explosive TATP, short for triacetone triperoxide, the spokeswoman for the prosecutor's office later added. He had also acquired two radios, batteries and a cellphone battery, suggesting he planned a remote-controlled explosion by radio or mobile telephone.
There were no indications that he was a member of a terrorist organization, the office said. It did not say when he arrived in Germany.
Chancellor Angela Merkel, who is trying to form a new coalition government after elections last month, has come under fire for allowing more than one million people to enter Germany over the past two years - many of them refugees from Syria.
Her 'open door' refugee policy saw her conservatives bleed support in the election to the anti-immigration Alternative for Germany (AfD), which won seats in the national parliament for the first time.
De Maiziere said the raid on the suspect took place "late enough to secure evidence and at the same time early enough to reliably ward off the danger."
"The threat situation in Germany remains high. Germany, Europe, the West are in the sights of Islamist terrorism," he added in a statement.