She said the asylum seekers responsible for deadly attacks in Ansbach and Reutlingen had "shamed the country that welcomed them" but that those fleeing persecution and war had a right to be protected, The Independent reported.

The attackers "wanted to undermine our sense of community, our openness and our willingness to help people in need. We firmly reject this," BBC quoted Merkel as saying.

Merkel proposes new counter-terrorism measures

Merkel also proposed new counter-terrorism measures to improve security, which included information sharing, deciphering web chatter and tackling arms sales on the internet.

Two recent attacks in Bavaria were both by asylum seekers.

A suicide bomb attack in Ansbach on July 24 that injured 15 persons was carried out by a Syrian who had been denied asylum but given temporary leave to stay.

Axe attack on train in Wurzburg

On July 18, a teenaged Afghan asylum seeker attacked train passengers with an axe in Wurzburg after declaring allegiance to IS and was shot dead by police, The Independent reported.

Both men had claimed allegiance to the Islamic State terrorist group.

Gun attack in Munich shopping mall

The deadliest recent attack -- in Munich on July 22 which left nine persons dead -- was carried out by a German-Iranian teenager but was not associated with the IS terrorist group.

Markel 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!" --"We can do this" -- uttered in 2015 when she agreed to take in a million migrants, Merkel said: "I am still convinced today that we can do it."

"It is our historic duty"

"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," she noted.

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

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