VIENNA — For nearly two years — through the height of the European refugee crisis and beyond — the far-right Freedom Party dominated opinion polls here with its message of keeping Austrians happy by keeping newcomers out.
Then came the youthful new face of the establishment: Sebastian Kurz, the wunderkind of Austrian politics, with his sweptback mane of dark brown hair, golden tongue and boasts of actual success in stopping migrants from reaching this land of Alpine vistas, low unemployment and generous social welfare.
At 30, Kurz took control of the People's Party, the fusty center-right party that had long lagged in the polls. At 31, the foreign minister is likely to become Austria's next chancellor following elections here Sunday that Kurz and his People's Party are widely expected to win.
Yet the far right will still be able to claim victory.
Kurz's face may be fresh, and his party may be comfortably rooted in the mainstream. But the hard-line ideas behind Kurz's success are unmistakably those long advocated by the Freedom Party, which has seen its once-fringe policies increasingly imitated at the center of Austrian politics.
"People always felt shame saying they were for the Freedom Party, because others would say, 'You're a Nazi,' " said Stefan Petzner, a political consultant and former adviser to the far-right party. "Now the People's Party has the same positions. But saying that you're for Kurz is sexy. It's cool."
The validation of hard-line rhetoric and policies by the European mainstream reflects just how far the continent's politics have shifted, even as far-right parties fall short of outright electoral victory. From Hungary to the Netherlands, anti-immigrant positions and slogans have gone from the margins to the middle.
Nowhere is that more apparent than Austria, a country at the meeting place of Europe's east and west, with a starring role in the 2015 refugee crisis.
Here, unlike in other parts of postwar Europe, far-right politics have long been a fixture, with the Freedom Party tracing its lineage to its founding in the 1950s by a former SS officer.
The party enjoyed relative success long before the current wave of nationalist politics swept Europe; in 1999, a second-place finish earned the Freedom Party a position in a coalition government and inspired fellow members of the European Union to impose sanctions on Austria.
The Freedom Party is again a strong contender to join the government this year, with an expected second-place finish making it a likely partner for Kurz.
But no one is talking about sanctions this time around. And unlike in past elections, when mainstream politicians largely ignored the Freedom Party's relentless emphasis on anti-immigrant policies as a balm for the nation's ills, this time they are joining in.
None are doing so with as much zeal as Kurz, who has placed get-tough immigration policies at the center of his campaign.
In one of the campaign's final debates this week, Kurz went toe-to-toe with the Freedom Party's leader — onetime neo-Nazi youth activist Heinz-Christian Strache — to prove that he is every bit as serious as his far-right rival about closing the central Mediterranean route for migrants, slashing benefits for new arrivals and curbing the influence of Islam in Austria.
"Mr. Strache, you're in the wrong debate," Kurz, wearing a crisp, open-collared white shirt, interjected at one point when challenged on his hard-line credentials. "You think you're sitting in front of a left-wing politician."
There's little chance voters will make the same mistake.
On the campaign trail, Kurz, who has been the nation's foreign minister since 2013 and would be the world's youngest head of government if made chancellor, draws cheers by touting his role in the spring 2016 decision to close Austrian borders to new arrivals. The move set off a chain reaction down the Balkan route and stranded thousands of people fleeing war, persecution and poverty as they sought to reach destinations farther north and west in Europe.
The closure was praised by the nationalist Hungarian leader Viktor Orban — a point Kurz made with pride during this week's debate — but rankled German Chancellor Angela Merkel, who was pushing for a more orderly end to the crisis.
Kurz says he will push for similarly decisive action to shut the central Mediterranean route, which is now the primary path for asylum seekers trying to enter Europe. He also highlights his efforts to pass Austria's burqa ban, and has vowed to put more money into the pockets of Austrian citizens by sharply reducing benefits for newcomers, whether they're refugees from Syria or immigrants from elsewhere in the E.U.
To the Freedom Party, it all sounds very familiar.
"Mr. Kurz took nearly 100 percent of our program," said Markus Tschank, one of the party's parliamentary candidates in Vienna. "He just copy-pasted it, and put a nice smile on it."
To the ruling Social Democrats, who have been top dog in a coalition government with Kurz's party for the past four years, the foreign minister's promises sound "like a fairy tale," said Johannes Vetter, the Social Democrats' campaign manager.
"He claims that by solving the refugee problem, he'll solve all your problems," said Vetter, whose party is mired in third place amid a scandal involving deceptive Facebook pages. "It's like Donald Trump saying he'll solve all problems by building a wall."
But the center-left Social Democrats have hardly been a beacon of support for immigrants and refugees. Many of the party's policies are similarly tough on new arrivals, and Vetter said public opinion in Austria has swung so far right that it's not worth trying to change minds.
"We don't have a dreamy view of multiculturalism," Vetter said.
Especially compared with Germany, attitudes in Austria toward newcomers have never been terribly friendly. But the refugee crisis hardened opinions as hundreds of thousands of people made their way through the country — and tens of thousands settled.
Kurz's allies say his focus on voters' concerns over immigration and integration will blunt the appeal of the populist right by offering a more palatable alternative.
"One of the biggest challenges for Europe is the present polarization, and the biggest cause of polarization is when you look away from a problem and don't address it head-on," said Karl Mahrer, a People's Party candidate in Vienna.
But the anti-immigrant rhetoric also risks feeding the polarization.
On the streets of Vienna's working-class 10th District, where women in hijabs push strollers past kebab stands, some native-born Austrians aren't shy about expressing their contempt.
"I was born in 1941, and Austria was absolutely destroyed," said Rudolf Wollner, a retired factory manager. "We had to work for everything we had. But the people coming now, they don't want to work."
His 70-year-old wife, Irene, said she had been counting what she considered "foreign" faces as she walked from the subway station. "There were 15 of them, all with dark skin," she said, shaking her head.
Miriam Iddrisu, 32, was among the nonwhite faces — though she was born in Austria, to an Austrian mother and a Ghanaian father.
Attitudes in the country, she said, were becoming more hostile as the rhetoric from politicians turned sharply xenophobic.
"There's been a shift. A few years ago, they would have talked behind your backs. But now people are becoming more and more openly racist," said Iddrisu, a social worker who works with Vienna's homeless. "The politicians are blaming foreigners for everything. It's an easy explanation for all the problems of Austria."
Luisa Beck contributed to this report.