Stefanie Loos / Reuters

A year after German Chancellor Angela Merkel opened Germany’s doors to tens of thousands of refugees stranded across southern Europe with the now-famous declaration, “We can do it!,” she’s fighting for her political life. Her popularity has sunk to a five-year low. The far right is ascendant. And her own Christian Democratic Union (CDU) party and political allies attack her daily. Even her leftist coalition partner, the unpopular Social Democrats, have turned on her, claiming that “she” (they’re in the government, too, after all) has done too little to assuage the upsurge of German angst over the country’s stance on refugees.

This month, Merkel and the CDU were dealt a stunning blow when, for the first time, a far-right party, Alternative for Germany (AfD), came out ahead of the CDU in a regional election. A year prior to national elections—in which Merkel has not committed to running—the German political establishment is in turmoil.

The irony is that Merkel’s government has, to a large degree, succeeded both in stemming the flow of refugees to the country and in processing and accommodating the asylum-seekers who have reached it. This time last year, many thousands of people were arriving in an unprepared Germany each day, from countries across the Middle East, North Africa, and the Balkans. Columns of migrants marched across fields and down highways. Families settled in overflowing camps or slept under the stars in major cities. Last year, 1.1 million refugees entered Germany. But so far this year, only 226,000 people have applied for political asylum; in June, only 20,000 did so.

The dramatically reduced numbers are, to a large degree, though not exclusively, the work of the Merkel government. While Berlin has steadfastly refused to set maximum caps or shut Germany’s borders, it has gradually amended its open-door stance of a year ago. The Balkan countries, as well as Morocco and Tunisia, are now considered “safe states,” which means their citizens are no longer eligible for political asylum (a course change that human-rights groups sharply criticized). Moreover, German authorities can offer them a one-year term of stay if their safety in their homeland is considered precarious (but not warranting of political asylum).

Moreover, late last fall, it was Merkel who brokered the EU’s controversial migration pact with Turkey. Per the deal, the Turkish government agreed to halt the exodus of migrants to Europe through Turkey, and accept migrants back from Greece, in exchange for aid and the promise of visa-free travel in Europe. The terms of this, too, have drawn criticism given Turkey’s human-rights record; at the same time, the pact has helped stem flows of asylum-seekers. Germany has also profited from the closing of the Balkan route, a measure that the frontline countries of the region and Austria took by securing their borders militarily, which is a move Merkel has refused to make.

Moreover, Germany is now considerably better prepared to handle the flows. Though the bureaucratic processing of asylum-seekers is still cumbersome, Germany now has the machinery to do so efficiently: Application processes are faster, relevant language-translation power is in place, and local administrators and volunteers are now battle-tested and competent. Simply put, Germans now have the drill down. Better, at least, than they did a year ago.

This extends to Germany’s civic space. No longer are charities and churches screaming for volunteers to build beds and collect winter jackets. Instead, they’re teaching thousands of asylum-seekers and recognized asylees to speak German, and offering mandatory courses on German culture and civics. Benefits are withheld from those who don’t participate—another controversial Merkel measure intended to appease the right. New laws expedite the introduction of applicants and asylees into the labor force, and children into schools.

Germany, a country with a patchy postwar record of integrating its immigrants, has invested heavily in bringing asylees into the fold. In 2016, the Bundestag passed a law allocating 7 billion euros, the equivalent of some $7.7 billion, toward integration. Another 500 million euros is earmarked for the construction of social housing in 2017 and 2018. The government has promised to create over 100,000 new “working opportunities” for newcomers. Berlin has also suspended a law stipulating that German businesses give priority to German or EU job applicants over asylum-seekers.

So if the Merkel government has done so much to address the chaos of the 2015 crisis, why don’t many Germans see it that way? Although polls still show most Germans favor migration and maintaining the right to asylum, there has been a dramatic shift. For example, 41 percent of Germans agree that “we should not allow ourselves to be overrun by migrants,” versus only 28 percent who agreed with that sentiment two years ago. Today, 60 percent believe that migrants alone should adapt to live in Germany (rather than Germans themselves making some adjustments, too); in 2014, that figure was just 36 percent.

As for Merkel and her political allies: in a poll in September 2015, just after the height of the migrant crisis, she had a 63 percent approval rating. Today, only 45 percent of Germans today say they are satisfied with her. Her party is currently polling at 33 percent favorability, down from its 41.5 percent result in the 2013 federal election. The AfD would garner 14 percent countrywide were national elections.

The AfD’s recent electoral success in northern Mecklenburg-Vorpommern, a largely rural state of only 1.5 million inhabitants, dramatically underscored this trend. The party, which has been gaining momentum in Germany’s regional legislatures since its founding three years ago, tallied a record-high 21 percent of the vote, second only to the Social Democrats. All of the mainstream parties lost votes to the right wing, effectively turning the election into a referendum on Germany’s migration policies.

The AfD focused its campaign almost exclusively on the pro-refugee policies of Merkel’s centrist coalition. It ran a blatantly jingoist campaign with racist overtones, contending that refugees would increase crime, harass German women, steal German jobs, threaten German national security, and taint German culture. Critically, the vote was Germany’s first since the country suffered three terrorist attacks this summer, two of which involved refugees, resulting in nine deaths and injuries to two dozen people. And following the vote, just this week, German police arrested three Syrians on suspicions of ties with the Islamic State and links to the group's November 13 attacks in Paris.

What’s interesting about Mecklenburg-Vorpommern, however, is that refugees themselves don’t account for the AfD’s success there. The state has fewer refugees, foreign nationals, and people with migrant origins than any other German state. As of July, only 83 asylum applicants lived in Mecklenburg-Vorpommern. The state has been spared from any foreigner-linked crime waves, terrorism, or sexual harassment. While unemployed people tended to vote for the party, 71 percent of those who voted for the AfD have jobs: mostly men, middle-aged, middle-income, and blue-collar voters, many of whom had not voted previously.

Mecklenburg-Vorpommern’s history is part of the explanation. It is, historically, a right-wing state, even outstripping its fellow eastern German states, where the AfD also does well. For years the neo-Nazi NPD party has cleared the 5 percent hurdle for representation in the state. In the early 1990s, the region captured international headlines for its pogroms against asylum-seekers.

This leads to a simple, sobering conclusion, supported by polling of AfD supporters: The German far right taps into racist, Islamophobic, authoritarian undercurrents. For example, 75 percent of AfD voters say Islam is a threat to Germany. Eighty-six percent say “the refugees scare me.” Eighty-three percent say that refugees are treated better than they actually are. Among AfD supporters, Russian leader Vladimir Putin garners more respect as a leader than Angela Merkel. These stances make the far right exceptionally hard to battle.

Merkel’s colleagues, meanwhile, haven’t made things any easier. For over a year and a half, the Bavarian Christian Democrats of the CSU, the sister party of her CDU, have attacked her relentlessly for her refugee polices, even charging her with Rechtsbruch, or breach of law. Their claims are not substantially different than those of the AfD, though they seem to prefer to imply rather than shout. And now, Merkel’s once-close allies in the CDU are panicking, distancing themselves from her and calling for a rethink (what that means remains unclear) before the upcoming regional vote in Berlin.

What any of these actors believe they’ll gain by turning on Merkel is hard to say. Indeed, pandering to the far right only fans its fires: If given the option, why wouldn’t voters just cast their ballots for the real thing, rather than a weak imitation? One needs only to look to Austria, where conservatives caved to many of the far right’s positions on things like refugee policy, only to see the far right overtake them and nearly win the presidency earlier this year (there will be a revote because of irregularities in the first ballot, and currently the far-right candidate is leading.)

Merkel can take some comfort in the AfD’s poor showing in local elections in Lower Saxony over the weekend. But this was, in the end, only a local election. In Germany, as in Austria and elsewhere in Europe, only a broad coalition of democrats standing together against the extremists can tame the far right. But the Social Democrats and Christian Democrats have to explain and defend their own policies as strongly as Merkel does. Instead, Germany’s political establishment appears to be panicking, and offering few strong arguments that expose the far right for what it represents: empty populism with no answers to any of the complex tangle of issues facing Germany and Europe today.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.