A 27-year old Syrian migrant who set off an explosion killing himself and wounding at least a dozen people in Ansbach, Germany was a "soldier" of Islamic State (IS), according to the militant group's Amaq news agency.

Amaq reported that an "insider source" said the attacker "carried out the operation in response to calls to target countries of the coalition that fights Islamic State."

Bavaria's top security official told reporters Monday the attacker had recorded a video on his cell phone pledging alligiance to the leader of IS Abu Bakr al-Baghdadi. Joachhim Hermann also said bomb making materials such as gasoline and chemicals were also found in the assailant's home.

Ansbach, Germany

German Interior Minister Thomas de Maiziere has ordered beefed up security at transportation hubs and elsewhere.

The attacker had tried to kill himself twice before and had received psychiatric treatment, German officials say.

The man detonated the explosive device Sunday after being denied entry into a music festival in Ansbach near Nuremberg.

More than 2,000 people were evacuated from the festival after the explosion.

The bomber was denied asylum last year, but was allowed to remain in Germany because of the ongoing fighting in Syria.

Interior Ministry spokesman Tobias Plate said the bomber was set to be deported to Bulgaria. It was not immediately clear, however, when his deportation was scheduled to take place.

A special police officer examines the scene after an explosion occurred in Ansbach, Germany, Monday, July 25, 2016.

"Unfortunately, this is a terrible new attack which will surely increase people's anxiety," said Herrmann. "He had a backpack with explosives which also had many sharp-edged pieces of metal packed inside . . . we must assume . . . he wanted to bring disaster to as many people as possible."

More than a million refugees have entered Germany in the past year, many of them braving the treacherous waters of the Mediterranean Sea in search of better lives in Germany and other European countries.

Hermann said he is concerned "the right to asylum" is being placed in jeopardy by recent events involving refugees.

Earlier Sunday, a machete-wielding Syrian refugee killed a woman and wounded two other people in an attack in the southwestern city of Reutlingen, near Stuttgart.

Germany is on edge after the killing of nine people by an 18-year-old Iranian-German gunman in Munich Friday.

Last Monday, police shot and killed a 17-year-old Afghan asylum seeker after he wounded five people with an ax on a train near Wuerzburg.