BERLIN (AP) — Chancellor Angela Merkel said Tuesday she did the right thing by allowing large numbers of migrants into Germany two years ago and that Europe hasn't done enough to develop long-term solutions to the migration crisis since then.

A day after discussing the continuing influx of migrants with leaders from Africa and other European countries, Merkel tackled head-on an issue that once looked as if it would be a liability for her in Germany's Sept. 24 election.

Recent polls suggest the chancellor's popularity has returned to levels from before 2015, when the refugee crisis reached its peak. They show Merkel's conservative bloc leading by 13-17 points over her main challenger, Martin Schulz of the center-left Social Democrats.

Neither does a nationalist party that expanded its appeal with rhetoric highly critical of Merkel's welcoming attitude toward migrants appear poised to produce change at the top.

Alternative for Germany, or AfD, appears set to enter parliament next month, but its poll numbers have fallen well below where they stood after nearly 1 million migrants arrived in Germany in 2015.

Since then, Merkel's government has tightened asylum procedures and implemented other measures, and the influx has receded.

"It was important and right that we took people in back then in this exceptional situation, and is also right that we must find long-term, sustainable structures," Merkel told reporters Tuesday in Berlin.

She noted that the system under which migrants are supposed to seek asylum in the first European Union country where they arrive still needs reform, and that some nations are still refusing to take in a share of refugees arriving in Europe.

"Europe itself still hasn't done its homework to this day," she said.

The chancellor also appeared unworried about voter blowback from eurozone bailouts, another issue that has drawn criticism in recent years but failed to ignite in the campaign.

Turning to foreign policy, Merkel called on Turkey to release German citizens swept up in the aftermath of last year's failed coup attempt, calling their imprisonment "unjustified."

Turkey has arrested about 10 Germans in recent months on charges the German government considers dubious.

Mentioning German-Turkish journalist Deniz Yucel and several others by name, Merkel told reporters: "Our demand is very clear: those people who are in prison should be freed."

The arrests have contributed to worsening relations between Berlin and Ankara, which have also been strained by other issues.

"This is a very complicated phase of our relationship" with Turkey, Merkel said.

She added that Germany would not support the widening of a customs union agreement with Turkey and the EU "so long as the situation remains as it is."

Merkel sharply condemned a remark by a top AfD leader that her government's integration commissioner could be "disposed of in Anatolia," a name for the eastern part of Turkey.

The commissioner, Aydan Ozoguz, has Turkish roots and had said that "a specifically German culture is, beyond the language, simply not identifiable."

Merkel said Tuesday that AfD official Alexander Gauland's comment "is racist and absolutely to be condemned."

Gauland has backed away from his use of the word "disposed" but otherwise has stood by his remarks.

_____

David Rising contributed to this story.