Migrants seeking to escape poverty and war are flowing into Europe by the hundreds of thousands. They are still mostly being welcomed, but the capacity of the reception centers is fast reaching its limits. To staunch the flow of migrants over the Balkan route, Hungary has imposed controls on its borders — and was promptly followed by Germany, Austria, Slovakia, Croatia, Slovenia, the Czech Republic, the Netherlands and Poland.

Germany is the migrants’ most favored destination. So far this year, half of all asylum applications in the European Union have been filed there, although the country accounts for only 16 percent of the EU’s population. By September, Germany had probably received some 400,000 applications or more, with the dramatic increase in migration flows since summer and before the reinstatement of border controls expected to push the number of asylum-seekers to 800,000 this year.

Moreover, regular immigration to Germany could again reach the 400,000 mark, as in 2014. The total would represent net immigration of 1.5 percent of the resident population — an extremely high proportion by historical and international standards.

The reason for the migrants’ strong preference for Germany is that the country, together with Sweden, has Europe’s most liberal asylum system and allocates particularly high levels of funding to accommodate the newcomers. Between €1,000 ($1,120) and €1,200 per person per month is being transferred to the municipalities to cover the costs of accommodating them. The value of the benefits that the immigrants receive in Germany is a multiple of the wages they can earn in their home countries (if they manage to find a job there at all).

The Dublin Regulation, according to which the first EU country that a migrant reaches is obliged to register and process the migrant’s application, has long been disregarded. Greece and Italy are simply waving the refugees on. Germany accepted, with much fanfare, a large number of unregistered refugees from Hungary and offered them a warm welcome. This decision arguably tempted so many more refugees from the Arab countries that soon thereafter Germany was forced to impose border controls.

What the German government had not reckoned with is that every refugee who manages to make it to Germany immediately texts the good news back to the home country, fueling a fresh wave of migrants. The U.N. refugee camps in the countries surrounding Syria are thus being gradually relocated to Germany.

Only a fraction of asylum-seekers’ applications are ultimately approved, because most applicants are not politically persecuted but simply economic migrants. In the first half of 2015, for instance, only about one-quarter of applicants came from Syria and Iraq, a significant proportion of whom had already found shelter in the U.N. camps in or around those countries. But the proportion of Syrian refugees subsequently ballooned quickly, in part because the news spread that Germany approves most Syrian applications.

If an application is successful, a refugee has the right to bring along his or her family members as well. Frequently, Arab families send their minors to Germany in the not-unjustified hope that they will obtain the right for other family members to follow later. Germany will have to deal with the consequences of this refugee wave for years to come.

In order to distribute the burden more equitably, Germany tried to have a European quota system instituted to allocate applicants among the EU’s member countries. But Germany’s EU partners rejected this as “moral imperialism.”

Germany thus failed to have a system adopted that would have provided it with some relief. Instead, a quickly convened summit has now agreed on a limited quota system that will cover barely 120,000 people, aimed at providing relief to Hungary, Italy and Greece; it will bring a further 31,000 refugees to Germany.

In order to avert chaos, Germany has no choice but to impose restrictions. Among the most urgently needed steps is to develop the capacity to distinguish quickly — and ideally at the border — between refugees (who face political persecution) and economic migrants. Germany’s Federal Office for Migration and Refugees could set up border outposts to clear baseless asylum claims and send the rejected applicants, in accordance with the Dublin Regulation, back to the first safe country they reached.

This would allow Germany to concentrate on the task at hand: providing those granted refugee status the schooling and language lessons they will need to allow them to find employment as quickly as possible.

Hans-Werner Sinn, a professor of economics and public finance at the University of Munich, is president of the Ifo Institute for Economic Research and serves on the German economy ministry’s Advisory Council. He is the author, most recently, of “The Euro Trap: On Bursting Bubbles, Budgets and Beliefs.” © Project Syndicate, 2015