Updated

Germany's top security official complained Wednesday of an "unacceptable" influx of Afghans from relatively safe areas of their country, and warned that many of them will have to return home.

Germany is struggling to accommodate hundreds of thousands of refugees and other migrants who have arrived this year.

Syrians, the biggest single group of new arrivals, are more or less assured asylum because of the civil war in their country. But Interior Minister Thomas de Maiziere said Afghanistan is in second place both for October and the year to date.

"This is unacceptable," he told reporters in Berlin. "We agree with the Afghan government that we don't want this, and there are also increasing numbers of members of the middle class — including many from Kabul."

De Maiziere said Germany agrees with the Afghan government that young and middle-class Afghans should stay home and rebuild the country. "German soldiers and police officers are contributing to making Afghanistan safer," he added.

Germany, a longtime contributor to international forces in Afghanistan, currently has 944 soldiers in the NATO-led Resolute Support training mission there.

"Large amounts of development aid have gone to Afghanistan — so we can expect that Afghans stay in their country," de Maiziere said. "So I am saying very clearly today that people who come to us as refugees from Afghanistan cannot all expect to be able to stay in Germany."

De Maiziere said Germany isn't going to declare Afghanistan a "safe country of origin," as it has with several Balkan countries, and stressed that asylum applications will be examined carefully on a case-by-case basis.

However, he said Germany will work with the Afghan government to ensure that people are returned and that the European Union will negotiate a deal with Kabul so that it takes rejected applicants back.