Christian Von Hoffmeister rarely voted in German elections because he felt no party was sympathetic to his views that Muslims were incapable of integrating into society. That changed a couple of years ago when the Alternative for Germany (AfD) party quickly evolved from a euroskeptic party of minor appeal to the voice of the anti-immigrant right.

Suddenly, Mr. Von Hoffmeister, 44, who works in Internet marketing in Berlin, was presented with a party he could support. He intends to vote for AfD in Sunday's federal election and expects it to place as high as third, behind chancellor Angela Merkel's ruling conservatives (the CDU/CSU bloc) and the centre-left Social Democratic Party (SPD), led by Martin Schultz, former president of the European Parliament.

"We needed a right-wing party here," Mr. Von Hoffmeister said. "We have so many people who don't belong here. … There is no country anywhere in the world where Muslim migration has been a success. If the AfD is the number three party it will be hard for Germany to open the immigration gates."

Story continues below advertisement

His prediction that the AfD will place as high as third is not far-fetched. The latest polls put the party at 10-12 per cent, a significant improvement from the 7-per-cent level recorded in August. AfD is on course to win 50 or more seats in the 630-seat Bundestag, making it the first right-wing party since the 1950s to sit in the German parliament.

In a parliament dominated by two big, centrist parties, it appears that a significant minority of conservative Germans, disappointed by the expansive mushy middle, are embracing a right-wing, Germany-first party that promotes nationalism, euroskepticism and anti-immigrant policies. AfD's possibly strong presence in the Bundestag will challenge Ms. Merkel's liberal order, filling the traditionally sober chamber with angry and caustic debates.

Most Germans are appalled the AfD, which was initially written off as an historic blip, will win so much support on Sunday, possibly beating established small parties such as the Greens and the Free Democratic Party (FDP), both of which are possible coalition members in Ms. Merkel's new government, assuming she wins a fourth term. "I am astonished that this much of the population will accept these thinly disguised fascists," says Olaf Gersemann, business editor of the German national newspaper Die Welt.

AfD has had a short, traumatic life beset with infighting and policy-direction squabbles that could have left it for dead at any point but never quite did. How did it go from a reasonable euroskeptic party to a right-wing anti-immigrant party prone to outrageous, racist outbursts?

In short, it was Ms. Merkel's decision in 2015 to open Germany's borders to refugees, mostly from Syria and Afghanistan. "It's our damn duty to help refugees," she said as almost a million migrants crossed Germany's borders, triggering fears among many Germans of an endless, uncontrollable flow of migrants that could overwhelm the resources of governments, security forces and public health agencies.

AfD was formed in the autumn of 2013 by Bernd Lucke, an economics professor at Hamburg University, and several like-minded colleagues who thought that the bailout of Greece was a flagrant violation of European Union laws, which said that no EU member state has to pay for the debts of another. At the time, Ms. Merkel argued there was "no alternative" to the Greek bailout. Mr Lucke said there was and created Alternative for Germany to prove it.

The fledgling party failed to make the 5-per-cent threshold cut in the 2013 German federal election, but didn't sit on the sidelines for long. A year later, as its popularity was trending up, it took 7 per cent of the German vote in the European Parliament elections and sent seven MEPs to Brussels.

Story continues below advertisement

At the time, the AfD was a genuine euroskeptic party but also appealed to voters who thought Ms. Merkel had steered her conservative political machine too far to the left as she tried to solidify her support by occupying the middle ground. A book on the AfD by journalist Melanie Amann noted that AfD supporters reflected a broad range of German society – men and women, the rich and the poor, professionals and the unskilled.

But the party also appealed to nationalists, who began to infiltrate its ranks. In the AfD's party conference in 2015, Mr. Lucke and his moderate forces were ousted. In came Frauke Petry, now 42, a German chemistry graduate who describes herself as a national conservative but holds some decidedly far-right views. She is anti-Muslim, wants to ban minarets and, near the height of the refugee crisis, condoned the use of "firearms if necessary" to "prevent illegal border crossings."

Under her leadership, the AfD enjoyed a popularity surge as hundreds of thousands of migrants streamed into Germany in the last half of 2015 and into early 2016. The party's rise was fuelled by security fears brought about by reports of migrant attacks against Germans, notably the sexual assaults on dozens of women by men of North Africa origin on Dec. 31, 2015, in Cologne. A year later, when an asylum seeker from Tunisia killed 12 people by driving a truck through a Berlin Christmas market, AfD's ratings climbed again.

At its height, AfD was polling at about 16 per cent. "A lot of people were afraid of uncontrolled migration and abuse of the asylum system," says Hugh Bronson, the German-British politician who was elected last year to the state parliament of Berlin (Berlin is a city state) as an AfD member. "This immigration put enormous strain on local communities."

Then AfD support began to crumble as quickly as it rose. Sensing that the anti-immigrant right was stealing her thunder, Ms. Merkel tightened up asylum rules. The number of refugee arrivals plummeted and the crisis began to fade. About the same time, Björn Höcke, one of the highest-profile AfD firebrands, alienated many supporters, including Ms. Petry herself, when he stepped firmly into anti-Semitic territory. In a January speech referring to the Holocaust memorial in Berlin, he said "we Germans are the only people in the world who have planted a memorial of shame in the heart of their capital."

That outburst, combined with more internal squabbling, sent AfD's ratings tumbling down. They're rising again, in part, it appears, because Ms. Merkel's middle-of-the-road conservatives are likely to win a fourth term, creating space for a right-wing party. "The system has made room for conservative voters who were left behind," Mr. Bronson said.

Story continues below advertisement

Now that it's virtually assured that AfD will make it into the Bundestag, the question is: How will its presence change the debate in Europe's largest and most liberal economy?

Christian Odendahl, chief economist of the Centre for European Reform, thinks the party will be mostly ignored and could vanish, as Germany's little social liberal Pirate Party did. "The CDU and SPD are embedded in the centre and will not tolerate a party to their right," he says. "They will work to neutralize the AfD."

Others aren't so sure.

Denis MacShane, a former Labour Party MP in Britain who was minister for state for Europe, says fringe parties can sometimes have enormous influence, as the UK Independence Party (UKIP) did in Britain. Under Nigel Farage, UKIP (which has no seats in Parliament and 20 MEPs in the European Parliament) became Britain's leading euroskeptic voice and probably swung the 2016 referendum in favour of Brexit, shattering the integrity of the EU.

Mr. Bronson, the Berlin state AfD parliamentarian, says he has no doubt that AfD will change the culture in the Bundestag, making its parliamentarians take immigration and security matters more seriously. The AfD will be hard to ignore if it becomes the third party, making it, in effect, the opposition. Mr. Gersemann, the Die Welt business editor, agrees. "No one saw a party like AfD coming," he says. "They're coming."