A Syrian man who blew himself up injuring 15 people outside a music festival in the south German town of Ansbach was previously known to police for suicide attempts and drug offences, authorities said.
The 27-year-old, who has been named in German media as Mohammad Daleel, detonated a rucksack bomb at the entrance to the music festival after being denied entry.
Police found a video showing Daleel pledging allegiance to the leader of Isis, Bavaria's top security official said.
Officials also said police found violent videos and bomb-making material at his home.
Joachim Herrmann, Bavaria's top security official, said officers discovered videos with "Salafist content" on storage devices seized at the Syrian man's home.
He told reporters police also found gasoline, chemicals and other material that could be used to make a bomb.
Daleel had been living in Germany for two years and had spent time at a psychiatric hospital in Ansbach.
Last year his application for asylum was rejected by German authorities, though due to the civil war in Syria he had been allowed to stay in Germany.
Four of the people injured are in a critical condition, police said.
On Monday, armed police were seen at two addresses the man had lived at looking for evidence.
At a news conference early on Monday morning, Bavarian interior minister Joachim Herrmann said the backpack had been filled with sharp pieced of metal used in “wood manufacturing”, and could have killed many more people.
He said it was unclear whether the man had planned only a suicide attack or whether he wanted to kill more people, but added that it appeared to me more than just a “pure suicide attempt”.
“It’s terrible,” Mr Herrmann said, “that someone who came into our country to seek shelter has now committed such a heinous act and injured a large number of people who are at home here, some seriously.”
“It’s a further, horrific attack that will increase the already growing security concerns of our citizens. We must do everything possible to prevent the spread of such violence in our country by people who came here to ask for asylum.”
The explosion is the third attack on Bavarian civilians in the past week, after a teenager with an axe and a knife attacked people on a train last Monday, and on Friday an attack in Munich by an 18-year-old gunman left nine people dead.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies