Germany is likely to face more Islamist attacks, its interior minister said on Wednesday, but played down any link between the government's open-door refugee policy and Monday's ax assault on a train in Bavaria.
Anti-immigrant party Alternative for Germany (AfD) has seized on the train attack to criticize Chancellor Angela Merkel's migrant policy, under which some 1.1 million people entered Germany in 2015, many fleeing war in Syria, North Africa and Asia.
"You cannot say there is no connection between refugees and terrorism, but the danger was high before and remains high, regardless of questions about refugees," Interior Minister Thomas de Maiziere said.
A 17-year-old who had sought asylum in Germany was shot dead by police after wounding four people from Hong Kong, some of them severely, on the train and injuring a local resident while fleeing the scene near the city of Wuerzburg.
The perpetrator was initially thought to be Afghan but de Maiziere said on Wednesday there were indications he was from Pakistan. Officials have said the attacker came to Germany as an unaccompanied minor and registered as a refugee in June 2015 at Passau on the Austrian border.
The train attack came four days after a Tunisian delivery man drove a truck into crowds celebrating Bastille Day in the French city of Nice, killing 84 people. Militant group Islamic State has claimed both attacks.
De Maiziere said the government had introduced measures to improve security in the last year but warned: "Like several EU countries, like the whole EU, Germany is also in the target area of international terrorism ... the situation is serious."
Investigations pointed to the train attacker being a "lone wolf" who had been spurred into action by Islamic State propaganda, said de Maiziere.
Police found a hand-painted Islamic State flag in his room and a letter he appeared to have written to his father which officials said read: "And now pray for me that I can get revenge on these non-believers, pray for me that I go to heaven".
Islamic State posted a video, described by de Maiziere as authentic, in which a man whom it identifies as the refugee vows to carry out a suicide mission and urges others to do the same.
De Maiziere said it was unclear when the film was made, adding it was "a classic farewell video by a suicide attacker".
Germany's federal prosecutor said on Wednesday an investigation had been opened into the case and it was necessary to clarify whether other people were involved in the attack or helping behind the scenes.
It launched an investigation against persons unknown on suspicion of belonging to a "foreign terrorist association" and attempted murder. It did not provide further details.
It is unclear how the youth became radicalized. He was living with a foster family and had a part-time job at a bakery.
De Maiziere said Germans would have to get used to more video surveillance and police officers on the streets.
"We need the active cooperation of Muslims living here, including the mosque communities working here. They, too, must make a contribution to integration, to prevention and to spotting the radicalization process early on," he said.
Steffen Seibert, spokesman for the German government, warned against harboring general suspicion toward the refugees in the wake of the train attack, saying: "A cruel attack carried out by an individual can't discredit a group of many thousands."