A teenage Syrian asylum-seeker arrested in Germany was planning a bomb attack on behalf of Isil, it has emerged.

The 16-year-old, named only as Mohamed J under German privacy laws, was arrested at a refugee shelter in Cologne on Tuesday.

Police said yesterday he had been in contact with an Isil handler in the Middle East who told him how to make an explosive device and where to plant it.

The teenager's arrest came hours after the German interior ministry warned that jihadist sympathisers were targeting child asylum-seekers as potential recruits.

"We had to act decisively to protect the population," Jürgen Mathies, the Cologne police chief said.

Police were first alerted to changes in the boy's behaviour in June by the mosque where he regularly prayed.

"It was reported that the boy was behaving weirdly, he would only eat fruit, anything else was unclean," Mr Mathies said.

"He was also praying more. He would face in a different direction than is usual for Muslim prayer."

Earlier this month, the mosque contacted police again to say that the boy was spending hours praying and communicating with someone on his phone using instant messaging.

Police began monitoring the teen's mobile phone and online activity and were shocked when they discovered he was in contact with an Isil handler about how to build a bomb.

"The turbocharged radicalisation of the boy is alarming," Ulf Willhun, the prosecutor in charge of the case, said.

"They also explained to him where to place explosive devices for an attack, and addressed the alleged legitimacy of killing according to Isil."

The decision was taken to act immediately to prevent any risk of a terror attack. Police special forces stormed the refugee shelter and took Mohamed J into custody.

Isil claimed responsibility for two terror attacks by asylum-seekers in Germany in July.

A teenage Afghan refugee injured five people in an axe attack on a train before being shot dead by police, and a rejected Syrian asylum-seeker killed himself and injured 15 others in a suicide bombing.

Both left messages in which they pledged allegiance to Isil.

Authorities know of 340 cases in which extremists tried to make contact with asylum-seekers since October last year, the interior ministry said in a written answer to a parliamentary question.