BERLIN — A 16-year-old Syrian refugee who was arrested in western Germany had contact with a recruiter for the Islamic State group and instructions for making explosives, authorities said Wednesday.

The unnamed suspect was detained Tuesday by a tactical response team at a refugee shelter in Cologne’s eastern district of Porz, after fellow migrants and a local mosque raised concerns about the teen’s behavior.

Records on the suspect’s phone showed he had communicated with a person abroad linked to the Islamic State group “who wanted to win the young Syrian over for Islamist activities,” police said.

Investigators found that the teen had chatted about when Muslims are allowed to kill somebody, received instructions on how to construct an explosive device and discussed traveling to the Middle East.

The suspect also expressed “unmistakable willingness” to carry out an attack, said Cologne police official Klaus-Stephan Becker.

The city’s police chief said that the suspect was first registered in Germany together with his parents and sister in January 2015. Juergen Mathies said the teen appeared to have come from a “good home” and that his parents were academics who had lived in Damascus before fleeing the civil war in Syria.

The suspect was questioned three times by police in recent months following tips from social workers, fellow refugees and a Cologne mosque that suggested the teen had undergone a rapid process of radicalization.

German authorities are on alert for possible extremists who might have entered the country as part of the influx of migrants in recent years.

Two attacks carried out by migrants in Germany in July were claimed by IS. In both, only the attacker was killed.