A Syrian man who detonated explosives outside a music festival in the German city of Ansbach, killing only himself and wounding at least 15 people, had pledged allegiance to the Islamic State of Iraq and the Levant group before the attack, according to a senior government official.

The 27-year-old suspect, who was a refugee, blew himself up late on Sunday after being denied entry to the event.

Joachim Herrmann, the interior minister of Bavaria, said on Monday that video footage discovered on the suspect's mobile phone showing him pledging allegiance to Abu Bakr al-Baghdadi, the self-declared leader of ISIL, also known as ISIS, makes it clear the incident was a "terrorist attack".

INSIDE STORY: How did the media cover the Munich attack?

He said the man, who has not been named, also "announced an act of revenge against Germans because they were standing in the way of Islam".

Moments later, ISIL claimed responsibility for the bombing on its Amaq website, saying that the attacker was one of its "soldiers".

Bomb materials found

Al Jazeera's Dominic Kane, reporting from Berlin, said: "He [the suspect] came to Germany two years ago and his asylum application was rejected last year for reasons that we don't know right at this minute.

"He had been based in Germany with the knowledge that he was not going to receive permanent asylum in this country. He had twice before tried to take his life and, at some point in the recent past, he had been receiving psychiatric help."

German police also said on Monday that they had found enough materials to make another bomb at the suspect's home, and several violent videos.

READ MORE: Munich suspect 'obsessed' with mass shootings

Germany will boost its police presence at airports and train stations and carry out stop-and-search operations close to border areas, Thomas de Maiziere, Germany's interior minister, said in Berlin on Monday after four violent attacks in less than a week.

"What seems particularly important to me at the moment is an increased police presence in public spaces.

"I have therefore ordered that the federal police visibly increase their presence at airports and railways stations and that there are random checks, which are not visible but very effective, in border areas."

READ MORE: Syrian arrested after deadly machete attack

On July 17, an Afghan refugee attacked passengers on a train in Wurzburg in Germany's south. He was later killed by police.

On Friday, an 18-year-old German-Iranian opened fire in Munich, killing at least nine people, and himself.

On Sunday, a Syrian refugee in Reutlingen killed one Polish woman, with whom he was reportedly in a relationship, and injured at least two others, before being arrested at the scene.

READ MORE: ISIL flag found in room of German train attacker

Later in the day, the attack in Ansbach came near the end of the closing night of a popular open air festival being attended by about 2,000 people.

Just hours earlier in Munich on Sunday evening, 1,500 people gathered at the scene of the shooting there, lighting candles and placing flowers in tribute to the victims. Police said that the suspect had planned the attack for a year.

On Monday, DPA reported that a group of asylum seekers in the state of Brandenburg alerted authorities after seeing a Syrian refugee with a gun. The gun, which a police spokesman said could have been non-lethal or a replica, was seized and taken for forensic examinations. The arrested refugee was being investigated for possession of illegal weapons.