Scene of explosion in Ansbach, Germany
Scene of explosion in Ansbach, GermanyReuters

A Syrian with suspected links to the Islamic State terrorist group (ISIS) who blew himself up outside a German music festival in Ansbach, Bavaria, was in contact with another person "who influenced the attack" immediately beforehand, authorities said Wednesday.

The 27-year-old failed asylum-seeker, who wounded 15 people at a nearby cafe late Sunday when he was refused access to the festival venue, had been speaking to an unknown person in an "intensive" online chat, Bavaria state interior minister Joachim Herrmann said.

"Apparently he had direct contact with someone who had significant influence on the way the attack played out," Herrmann was quoted by DPA news agency as saying on the sidelines of a state government meeting.

"The chat ended immediately before the attack."

Herrmann said it was not immediately clear whether the unknown person had contact with Islamic State jihadists, where the chat participant was, or how long the two had been in contact.

Herrmann revealed on Monday that the attacker had made a video pledging allegiance to ISIS leader Abu Bakr al-Baghdadi that was found on his smartphone.

ISIS later said via the jihadist-linked Amaq news agency that the attacker "was a soldier of the Islamic State" who had acted "in response to calls to target nations in the coalition fighting" the extremists.

The assailant, 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, authorities said.

Germany was already reeling after nine people were killed in a shopping centre shooting spree in Munich on Friday and four passengers on a train and a passer-by were wounded in an axe attack in Wuerzburg on July 18.

ISIS also claimed the ax rampage.

All three brutal incidents were in Bavaria, the southern state which has been a portal for tens of thousands of refugees under Chancellor Angela Merkel's liberal asylum policy.

AFP contributed this report.