BERLIN — Chancellor Angela Merkel on Wednesday strongly defended her government’s handling of the flood of migrants that crossed into Germany last year, but conceded that more still needs to be done and that concerns that have led to increasing support for an anti-immigrant nationalist party need to be taken seriously.

Merkel told lawmakers that since she addressed them at this time last year, Germany has managed to come a long way in dealing with the hundreds of thousands of migrants that flooded in to the country.

“The situation is many times better than a year ago, but there remains a lot to do,” she said.

On the weekend, Merkel’s Christian Democratic Union suffered an embarrassing election performance in Mecklenburg-Western Pomerania, where Merkel has her parliamentary constituency, when it was beaten into third place by the nationalist, anti-immigration Alternative for Germany, known as AfD.

The state is home to few migrants, but Merkel after the election conceded that the result was more about dissatisfaction with national issues rather than local matters.

She told Parliament, where AfD is not represented, that the election was a “black eye” inflicted by “those who rely on slogans and seemingly simple answers.” She said that voters’ concerns “whether founded or unfounded, should be taken seriously” by “all of us in this house,” noting that the party had taken away support from all other main parties.

“I am quite sure that if we resist this and stick to the truth, then we will win,” she said. “And that way we will win back the most important thing that we need — the trust of the people.”

In the past year, Merkel said, Germany has implemented policies speeding up integration measures for migrants with good prospects of staying, increased school funding to help their educations, and worked with cities and states to find solutions to local problems.

But she said Germany still needs to improve the mechanism for quickly processing and returning home migrants who have little chance of being given asylum.

She said Germany has also beefed up police and security forces to fight terrorism, but emphasized that “terrorism is not a new problem that came here with the refugees.”

Crimes committed by migrants have become a central issue in the debate over whether the decision to let in so many newcomers last year was correct, particularly since a string of sexual assaults and robberies in Cologne on New Year’s eve.

In a new report released late Tuesday, the Interior Ministry said the most recent figures showed the number of crimes committed by migrants in the first half of the year fell by more than a third. More than half of all cases were thefts, including shoplifting, or forgeries, including failing to pay for tickets on public transport. Just over 1 percent of crimes committed by migrants — 1,590 — were sexual assaults, including threats.

“In my view this shows that government support and integration measures appear to be working,” Oliver Malchow, who heads the GdP police union, told The Associated Press.

Since the weekend election, Merkel has been under renewed pressure by her conservative coalition partner in the national government, Bavaria’s CSU, to introduce an upper limit to the number of refugees entering the country, including a new call Wednesday from Bavaria’s Interior Minister Joachim Herrmann.

Germany this year has registered some 238,424 new arrivals from January to July, though many entered early in the year and new arrivals are now running at around 16,000 per month.

Merkel, who has vehemently rejected previous calls for an upper limit, emphasized in Parliament that the numbers this year were drastically reduced.

Merkel was ostensibly making a speech about her government’s 2017 budget plans, but she only mentioned the proposal about three-quarters of the way into the address, saying that it would be the third year in a row that Germany would have a balanced budget and it had the lowest unemployment rate in 25 years.

She said Germany needs to take a leadership role in global issues, including in the fight against terrorism, questions of “territorial integrity” such as seen in Ukraine, and Britain’s decision to leave the European Union.

“We serve our country… best if we are guided by our values that made us become what we are today: that is freedom, that is security, that is justice and that is solidarity,” she said.

Merkel said the world is in “critical condition” but added that “we can also tell the people that our country is in good shape.”

“Germany will remain Germany with everything that matters to us,” she said.

__

Frank Jordans contributed to this story from Bonn, Germany.