A suicide bomber who died after he detonated a bomb at a music festival in Ansbach, Southern Germany was a Syrian man who had been denied asylum.

The blast, which injured 12 people, three of them seriously, was near the entrance to a open-air music festival in the Bavarian city.

Around 2,500 people were evacuated from a nearby open-air music event where the attacker, who had been in Germany for more than a year, tried to gain entry.

Witnesses described seeing a rucksack explode, killing the man.

As they launched an investigation, local officials said it would be "purely speculation" whether his actions were linked to Islamic extremism.

The attack comes as Germany reels from Friday's massacre in Munich that left nine dead and dozens injured.

Read more: Munich shopping centre attack: Massacre gunman who murdered nine people was a teenager acting alone, police say

It is the third attack to hit Bavaria in a week, following an IS-inspired axe rampage by a teenager on Monday.

The final night of the three-day Ansbach Open music festival in the city around 90 miles north of Munich, was under way with when the chaos began.

Police began to receive reports of a blast in the city centre shortly after 10pm, thought at first to have been a gas explosion near a bar.

Witness Thomas Debinski described the "disturbing" scene in the small city as bystanders came to realise a violent act had taken place.

"People were definitely panicking, the rumour we were hearing immediately was that there had been a gas explosion," he told Sky News.

"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."

The concert was shut down and around 200 police officers and 350 rescue personnel flooded the scene, with investigators later confirming the blast had been caused by a bomb.

Read more: Munich shopping centre attack: Massacre gunman who murdered nine people was a teenager acting alone, police say

Bavaria's interior minister, Joachim Herrmann, said the suspect was a Syrian who had been rejected for asylum a year ago, but had been allowed to stay in Germany due to the civil war.

In January a programme was launched in Ansbach to help refugees assimilate by teaching them the basics of law in their new host country.

The initiative came amid growing tensions and concerns in Germany over the large numbers of migrants, and taught lessons on freedom of opinion, the separation of religion and state and the equality of men and women.

Police are yet to release more details on the attacker and he has not been named.

Michael Schrotberger, a spokesman for the prosecutor's office in Ansbach, said his motives remained unclear.

"If there is an Islamist link or not is purely speculation at this point," he said.

Investigators have appealed for any mobile phone footage taken at the scene of the attack, following similar appeals by Munich detectives who made their first arrest in connection with Friday's atrocity on Sunday.

The latest incident will add to a feeling of grief and insecurity in a country rocked by a spate of violent extreme acts.

On Monday a 17-year-old Afghan asylum seeker launched an axe and knife attack on passengers on a train in Wuerzburg.

Islamic State claimed responsibility for the attack in which five people were injured. The teenage axeman, Riaz Khan Ahmadzai, was shot dead by police.

Read more: Munich shopping centre attack: Massacre gunman who murdered nine people was a teenager acting alone, police say

On July 14 more than 80 lives were lost when a lorry ploughed into crowds watching a Bastille Day firework display in Nice, France. IS said it was also responsible for the attack by 31-year-old Mohamed Lahouaiej Bouhlel.

Earlier on Sunday a Syrian asylum seeker killed a woman with a machete and wounded two others outside a bus station in the south-western German city of Reutlingen before being arrested.

Witnesses said the 21-year-old man, who was known to police, was having an argument with the woman before attacking her. Police said the motive behind the attack is still not clear.