Two recent attacks in Bavaria were both by asylum seekers. A suicide bomb attack in Ansbach on Sunday that injured 15 people was carried out by a Syrian who had been denied asylum but given temporary leave to stay.

An axe and knife attack on a train in Wuerzburg on 18 July that wounded five people was carried out by an asylum seeker from Afghanistan.

Both men had claimed allegiance to so-called Islamic State.

The deadliest recent attack - in Munich on 22 July which left nine dead - was carried out by a German teenager of Iranian extraction but was not jihadist-related.

Image copyrightAPImage caption
The suicide attacker in Ansbach targeted crowds attending a music festival - he injured 15 people

'We can do this'

Mrs Merkel, who interrupted her summer holiday to hold the news conference in Berlin, said the asylum seekers who had carried out the attacks had "mocked the country that welcomed them".

But she insisted that those fleeing persecution and war had a right to be protected, and Germany would "stick to our principles" in giving shelter to the deserving.

Referring to the attacks that have taken place in France, Belgium, Turkey, the US and elsewhere, she said "taboos of civilisation" had been broken, and they were intended to "spread fear and hatred between cultures and between religions".

But in reference to her famous phrase "Wir schaffen das" or "We can do this" - uttered last year when she agreed to take in a million migrants - Mrs Merkel said: "I am still convinced today that "we can do it".

"It is our historic duty and this is a historic challenge in times of globalisation. We have already achieved very, very much in the last 11 months".

Image copyrightEPAImage caption
An Afghan asylum-seeker injured five people in an axe attack on this train in Bavaria

Mrs Merkel said that "besides organised terrorist attacks, there will be new threats from perpetrators not known to security personnel".

To counter this, she said: "We need an early alert system so that authorities can see during the asylum request proceedings where there are problems."

Mrs Merkel added: "We will take the necessary measures and ensure security for our citizens. We will take the challenge of integration very seriously."

Seven deadly days

A week of bloody attacks has frayed nerves in Germany, which led the way in accepting asylum seekers from Syria. To date, two of the attacks have been linked to a militant group:

Image copyrightGetty Images

18 July: An axe-wielding teenage asylum seeker from Afghanistan is shot dead after injuring five people in an attack on a train. IS claims the attack, releasing a video recorded by the attacker before the incident

24 July: A Syrian asylum seeker is arrested in the town of Reutlingen, Baden-Wuerttemberg, after allegedly killing a Polish woman with a machete and injuring two other people. Police suggest it was probably a "crime of passion"

24 July: A failed Syrian asylum seeker blows himself up outside a music festival in the small Bavarian town of Ansbach, injuring 15 other people.