BERLIN — The mood in Berlin’s political circles as the hours tick down toward election day might best be described by that ur-German instinct – angst.

Even though most of Berlin’s political hacks remain convinced Angela Merkel will win by a comfortable margin in Sunday's parliamentary election, they’re unnerved by a last-minute surge by the Alternative for Germany (AfD), a far-right party that until a few weeks ago many in the establishment believed had been defanged, at least for the moment.

As the campaign winds to a close, all but one of Germany’s leading pollsters project the party will finish in double digits. It scored 12 percent in the benchmark Deutschlandtrend poll last week, for example. Germany's two biggest parties, Merkel’s Christian Democrats and the center-left Social Democrats (SPD), meanwhile, have suffered slight losses in recent weeks.

Though the race for the bronze medal is still too close to call, there’s no denying the AfD is gaining momentum. A third-place finish — behind the Merkel’s conservative bloc and the SPD — could make the AfD Germany’s largest opposition party, bestowing on it a host of privileges, including generous public financing, that would make it a formidable political force.

A robust showing by the AfD would also complicate the coalition math for Merkel, possibly narrowing her options to another "grand coalition" with the SPD, an outcome many argue would only further strengthen the AfD.

The populist, anti-immigrant movement saw its star rise amid the refugee crisis in 2015. But after Merkel’s government toughened asylum rules and the influx of migrants began to ebb, support for the party weakened.

Voters ardently opposed to Merkel have only two real options — the leftist Die Linke party and the AfD.

After hitting a high of 16 percent in polls last September, the AfD fell to as low as 8 percent in August. The party was also plagued by infighting, further blunting its appeal.

Germany’s centrist parties, especially Merkel’s Christian Democrats (CDU), had taken comfort in the AfD’s dwindling fortunes for months.

“Trust in politics, especially in the CDU, has grown,” Peter Altmaier, Merkel’s chief of staff, said recently.

The AfD, meanwhile, stuck to its extremist anti-Merkel, anti-establishment playbook. What appeared to be missteps — such as a private email exchange in which party leader Alice Weidel reportedly attacked Germany’s democratic system and called the ruling political class “pigs”— did little to halt the AfD’s momentum.

Mainstream politicians, led by Altmaier, sought to ostracize the party, going as far as to tell Germans it was better not to vote at all than to vote for the AfD. Leading Social Democrats castigated the AfD as “Nazis.”

Critics say such attacks have only backfired.

"Given the prospect that the AfD could finish third on Sunday, this strategy can only be described as a spectacular failure,“ Jasper von Altenbockum, politics editor at the daily Frankfurter Allgemeine Zeitung, concluded this week, arguing that the insults have only mobilized the AfD’s base.

Such last-minute skirmishes notwithstanding, it’s also true that populist parties often strengthen in the final stages of election campaigns.

That effect is typically stronger when the projected outcome, as in the case of the German election, is a foregone conclusion.

Inevitable Merkel

Perhaps the best explanation for the late resurgence of the AfD is the perceived inevitability of another four years of Merkel as chancellor and a sense that no matter whom she governs with, little will change.

Even for close observers of Germany’s humdrum election campaign, identifying the policy differences between the big parties can be difficult.

That harmony was on full display in the only televised debate between Merkel and Martin Schulz, her Social Democrat challenger, in early September.

Some analysts say the encounter was a turning point in the campaign because it shifted the focus to smaller parties.

Here too, the AfD appears to have benefited from its outsider image. Of the five parties running against Merkel’s conservatives, three — the SPD, the Greens and Free Democrats — are open to a coalition with the chancellor.

That means voters ardently opposed to Merkel have only two real options — the leftist Die Linke party and the AfD.

What’s more, when it comes to immigration, an issue polls show is top of mind for many Germans, the AfD is the only party prepared to take a hard line on admitting asylum seekers.

The reemergence of the refugee crisis in recent months in the media appears to have bolstered the AfD’s position. Italy’s struggle to cope with an upsurge in arrivals from Africa in the summer renewed fears in Germany that it could face a new wave of migrants traveling north over the Brenner Pass through Austria to the German border.

Despite that prospect, Merkel has steadfastly declined to back away from her resistance to setting an upper limit on asylum seekers, a key demand of conservatives in her own camp.

For now, Merkel and her strategists can do little but sit and wait for the projections to roll in on Sunday afternoon. The party has been polling in the mid-30s, well below the 41.5 percent it won in 2013.

Even senior party officials appear to have little confidence in Sunday’s outcome.

"Everything is possible, from 31 to 43 percent," Reiner Haseloff, CDU premier in Saxony-Anhalt, reportedly told colleagues this week.