Police said 12 people were wounded, including three seriously, in the attack in Ansbach, a small town of 40,000 people southwest of Nuremberg that is also home to a US Army base.
The incident will add to growing public unease surrounding Chancellor Angela Merkel’s open-door refugee policy, under which more than a million migrants have entered Germany over the past year, many fleeing wars in Afghanistan, Syria and Iraq.
Bavarian Interior Minister Joachim Herrmann told reporters at a hastily convened news conference on Monday that it was unclear if the man had planned to commit suicide or “take others with him into death”, according to news website Nordbayern.de.
Herrmann, whose remarks were confirmed by a ministry spokesman, said the Syrian man arrived in Germany two years ago and had tried to commit suicide twice before.
The man was carrying a backpack filled with explosives and metal parts that would have been sufficient to kill more people, Herrmann said. He said he could not exclude the possibility of an Islamist-inspired attack, but said that would have to be confirmed by an investigation.
One US intelligence official, speaking on condition of anonymity, said investigators would focus on what the bomber was doing before he left Syria, why he was denied asylum, and whether the attempted attack was personal or political.
Herrmann said the man had apparently been denied entry to the Ansbach Open music festival shortly before the explosion, which happened outside a restaurant called Eugens Weinstube.
More than 2,000 people were evacuated from the festival after the explosion, police said. A large area around the blast site remained blocked off hours later.
Ansbach resident Thomas Debinski said people panicked when they heard the explosion, especially after the events of the past week.
“Suddenly you heard a loud, a really loud bang, it was like an exploding sound, definitely an explosion,” he said. “(People were) definitely panicking.”
Debinski said it soon became clear that someone had set off a bomb in a rucksack.
It was the fourth violent incident in Germany in a week, including the killing of nine people by an 18-year-old Iranian-German gunman in Munich on Friday.
Earlier on Sunday, a 21-year-old Syrian refugee was arrested after killing a pregnant woman and wounding two people with a machete in the southwestern city of Reutlingen, near Stuttgart.
“After what just happened in Munich, and today in Reutlingen, what you hear about, it is very disturbing, when you know that such a thing can happen so close to you, in such a small town as Ansbach,” Debinski said.
A refugee wielding an ax wounded five people near Wuerzbuerg, also in southern Germany, before he was shot dead by police a week ago.
Police said neither Sunday’s machete attack nor Friday’s shooting in Munich bore any sign of connections with Islamic State or other militant groups.
Islamic State claimed responsibility for the July 18 ax attack in Wuerzbuerg. The group also claimed responsibility for the July 14 attack France, in which a Tunisian man drove a truck into Bastille Day holiday crowds in the French Riviera city of Nice, killing 84 people.