A suspected suicide bomber has killed himself and injured 12 others, three seriously, in an explosion outside a wine bar in the German city of Ansbach.
Detectives have said the attacker was a 27-year-old Syrian man who had been denied asylum in Germany.
Security officials say he detonated an explosive device after being turned away from a music festival being attended by thousands of people because he didn't have a ticket.
Germany's Bild newspaper reported that he used a mobile phone prior to the detonation.
Joachim Herrmann, Bavaria's interior minister, said the contents of his backpack had the potential to kill and injure many more victims as they included both explosives and metal parts.
"Due to the situation in Syria, he was not deported. In spite of the rejected application, he was given exceptional leave to remain," Mr Herrmann said.
But speaking on Monday morning, a spokesman for Germany's interior ministry said there had been a threat of deportation, and that the suspect was meant to be deported to Bulgaria.
The man was known to the authorities and had repeatedly received psychiatric treatment, including for attempted suicide.
"We don't know if this man planned on suicide or if he had the intention of killing others," Mr Herrmann said.
"My personal view is that I unfortunately think it's very likely this really was an Islamist suicide attack," he told German news agency dpa.
"The obvious intention to kill more people indicates an Islamist connection."
But a spokesman for the prosecutor's office in Ansbach, Michael Schrotberger, took a more cautious line.
"If there is an Islamist link or not is purely speculation at this point," he said.
A large-scale operation involving 200 police and 350 rescue workers was launched, and a helicopter brought in.
Armed police have raided a building used to house asylum seekers three kilometres from the scene.
Detectives have asked anyone with mobile phone footage taken at the scene to send it in.
Witness Thomas Debinski said: "People were definitely panicking. The rumour we were hearing immediately was that there had been a gas explosion.
"But then people came past and said it was a rucksack that had exploded. Someone blew themselves up.
"After what just happened in Munich, it's very disturbing to think what can happen so close to you in such a small town."
A police statement stressed that there is no sign of any further attackers.

More than 2,000 people were evacuated from the nearby festival.
Germany has been on high alert following a series of incidents in recent days.
On Sunday, a Syrian refugee wielding a machete killed a woman and injured two other people in the German city of Reutlingen. The 21-year-old man was apparently acting alone and has been arrested.
And on Friday, nine people were killed in a shooting near a shopping centre in Munich, which was carried out by an 18-year-old who later turned the gun on himself.
Detectives have said the attacker was a 27-year-old Syrian man who had been denied asylum in Germany.
Security officials say he detonated an explosive device after being turned away from a music festival being attended by thousands of people because he didn't have a ticket.
Germany's Bild newspaper reported that he used a mobile phone prior to the detonation.
Joachim Herrmann, Bavaria's interior minister, said the contents of his backpack had the potential to kill and injure many more victims as they included both explosives and metal parts.
"Due to the situation in Syria, he was not deported. In spite of the rejected application, he was given exceptional leave to remain," Mr Herrmann said.
But speaking on Monday morning, a spokesman for Germany's interior ministry said there had been a threat of deportation, and that the suspect was meant to be deported to Bulgaria.
The man was known to the authorities and had repeatedly received psychiatric treatment, including for attempted suicide.
"We don't know if this man planned on suicide or if he had the intention of killing others," Mr Herrmann said.
"My personal view is that I unfortunately think it's very likely this really was an Islamist suicide attack," he told German news agency dpa.
"The obvious intention to kill more people indicates an Islamist connection."
But a spokesman for the prosecutor's office in Ansbach, Michael Schrotberger, took a more cautious line.
"If there is an Islamist link or not is purely speculation at this point," he said.
A large-scale operation involving 200 police and 350 rescue workers was launched, and a helicopter brought in.
Armed police have raided a building used to house asylum seekers three kilometres from the scene.
Detectives have asked anyone with mobile phone footage taken at the scene to send it in.
Witness Thomas Debinski said: "People were definitely panicking. The rumour we were hearing immediately was that there had been a gas explosion.
"But then people came past and said it was a rucksack that had exploded. Someone blew themselves up.
"After what just happened in Munich, it's very disturbing to think what can happen so close to you in such a small town."
A police statement stressed that there is no sign of any further attackers.

More than 2,000 people were evacuated from the nearby festival.
Germany has been on high alert following a series of incidents in recent days.
On Sunday, a Syrian refugee wielding a machete killed a woman and injured two other people in the German city of Reutlingen. The 21-year-old man was apparently acting alone and has been arrested.
And on Friday, nine people were killed in a shooting near a shopping centre in Munich, which was carried out by an 18-year-old who later turned the gun on himself.