Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

BERLIN — Chancellor Angela Merkel pledged Thursday to do "everything humanly possible" to ensure security in Germany following a string of attacks — including two carried out by asylum-seekers and claimed by ISIS.

Merkel promised to do everything to find out who was behind the "barbaric acts" and bring them to justice. Germany owes that not just to victims and relatives and other Germans, but also to other refugees, she said.

Angela Merkel tells reporters that Germany will give shelter "to those who deserve it" despite recent terror attacks. KAY NIETFELD / EPA

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The attacks have brought Merkel's policy of welcoming refugees under renewed criticism. More than 1 million came to Germany last year, although the influx has since slowed dramatically.

Merkel said that Germany will "stick to our principles" and give shelter to those who deserve it. However, she said the fact that two men who came to Germany seeking shelter carried out attacks claimed by ISIS "mocks the country that took them in."

Merkel said she would stand by her plans manage the country’s challenges. The government, she added, "will do everything humanly possible to ensure security in our free, democratic state of law."

"The fact that the events caused great insecurity ... fear, isn't in question. But fear can't be a good counsel for political action," she said.

The chancellor cut short her vacation this week to hold her annual summer news conference. She had faced criticism from opponents for her muted response to four violent attacks that shook the country over the past 10 days.

Also Thursday, Bavarian officials pledged to hire hundreds of extra police officers and urged tougher background checks on asylum-seekers as they presented an anti-terror plan following the four attacks.

Bavarian Interior Minister Joachim Herrmann said his state — where three of the four attacks took place — would hire some 2,000 additional police officers by 2020, improve police officers' equipment and create new offices to fight Muslim extremism and cybercrime.