Police blocked off the area and emergency services were at the scene. Bomb experts were also sent to determine the cause of the blast.
Ansbach deputy police chief Roman Fertinger said there were “indications” pieces of metal had been added to the explosive device.
Herrmann said the attacker, who came to Germany two years ago but had his asylum claim rejected after a year, had tried to kill himself twice in the past and had spent time in a psychiatric clinic.
The assailant, who lived in Ansbach, was already known to police, in particular for an offence linked to drugs, Herrmann also told news agency DPA.
Stephan Mayer, a deputy from Merkel’s conservative bloc, insisted that it was “completely wrong to blame Angela Merkel and her refugee policy” for the rash of violence over the last week.
But Mayer told the BBC that the 1.1 million migrants and refugees Germany let in last year represent a “big challenge” for law enforcement, even as the influx has dwindled in recent months.
“We were not able to register and control all the migrants that crossed the German border,” said Mayer, interior affairs spokesman for the Christian Social Union, the Bavarian sister party of Merkel’s Christian Democrats.
“We have to regain sovereignty and we have to regain the rule of rights. There’s a lot of space for improvement.”
Europe has been on edge for months after a string of deadly attacks claimed by the Islamic State jihadist group, including bombings in Brussels and carnage at Bastille Day celebrations in the southern French city of Nice.