With a colorless and reputedly prickly small-city mayor being challenged by a far-right candidate known for his charisma and business success, many Germans feared that the hard-line Alternative for Germany party was about to win its first City Hall.
But when the ballots were counted Sunday evening, voters in the city of Nordhausen had decisively returned their mayor to office, dealing a setback to a party that has drawn on nationalist and anti-immigrant sentiment to secure a firm hold in German politics.
“I thought it would be much, much closer,” said an early-round mayoral candidate, Andreas Trump, who ran for the conservative Christian Democrats and did not endorse a candidate for fear of driving voters into the arms of the rightists.
The election came as Alternative for Germany, which has a nationalist, anti-migrant platform, is on the rise across the country. The party, known as the AfD, won only 10 percent of the votes in the 2021 general election, but since then, it has benefited from frustration with Chancellor Olaf Scholz’s three-party government, the rising cost of living, worries about the war in Ukraine and a surge in immigration.
Now, the AfD is regularly above 20 percent in national opinion polls, well ahead of Mr. Scholz’s center-left Social Democrats. In the five states that were once part of East Germany, nearly a third of voters say they back it.
Before the vote in Nordhausen, in which the incumbent, Mayor Kai Buchmann, was challenged by the AfD candidate, Jörg Prophet, many thought the rightists might make a significant inroad into German governance.
“Nordhausen is simply swept up in the blue wave,” Thomas Müller, a former local journalist, said, referring the party’s campaign color.
Still, it was unclear if Nordhausen, despite its history as an East German municipality, would topple. A quaint city of 42,000 known for its schnapps distillery, it is an exemplar of Germany’s investment in its east, with modern trams and an impeccably maintained medieval quarter.
“It’s not an especially right-leaning place,” Mr. Müller said.
On Sunday, 55 percent voted for Mr. Buchmann, with 45 percent voting for Mr. Prophet.
Benjamin Höhne, a political scientist who studies Alternative for Germany, said that winning the mayor’s office would have represented “another important step in the AfD’s normalization strategy.”
“By showing they can take on communal executive responsibility, the hard-right-wing extremist core, which is increasingly crystallizing, appears to recede into the background,” he said,
This summer, AfD candidates won runoffs to lead a district in southern Thuringia and a small town in another eastern state, Saxony-Anhalt. The party has also gained ground at the state level. In Thuringia, Christian Democrats recently pushed through a property tax measure with AfD votes, three years after an outcry when mainstream parties allied with the far right to briefly oust the state’s leftist governor.
None of this, however, means that the AfD is abandoning its extremes.
That may have proved Mr. Prophet’s undoing.
In the days after the first mayoral vote in Nordhausen, he turned away from city issues and solicited the help of two prominent AfD party figures who came to give speeches. He also refused to distance himself from Björn Höcke, the party’s most famous far-right extremist.
“If he had really limited himself to just the municipal issues — there’s no telling how it would have turned out,” said Mr. Trump.