The right wing Alternative for Germany, or AfD, may achieve a third-place finish in elections on Sunday, which would make it the lead opposition party in the next parliament.

It is a prospect viewed with trepidation by many in Germany. Chancellor Angela Merkel recently described heckling she received from members of the party during a recent election meeting as 'a kind of intolerance that is very, very difficult'.

Merkel is on course to win a fourth term in office, but her conservative Union bloc is predicted to fall short of the 41.5 percent support they won in 2013.

The chancellor has faced strong opposition from the AfD, which has stridently attacked her decision to allow in large numbers of refugees and other migrants in 2015.

Chancellor Merkel is hoping for a narrow majority for a centre-right coalition in parliament with the pro-business Free Democrats, with whom she ran Germany from 2009 to 2013 - but she may opt to from an alliance with the left-leaning Greens

Merkel is also thought to have benefited in the eyes of voters because of her foreign policy experience, which includes dealing with the European Union, tough talks with Russian President Vladimir Putin and engaging cautiously with President Donald Trump

The election campaign is widely seen to have been a little lacking in colour, with Merkel's immigration policies one of the few hotly contested issues

It is not yet clear how strongly the AfD will perform in the vote, largely because its level of support is likely to be determined by how successful it has been in appealing to protest voters dissatisfied with other parties.

Merkel, chancellor for 12 years, ran her campaign on limiting tax cuts and keeping Germany's borrowing to a minimum. She hailed Germany's low unemployment rates and strong economic growth in a volatile world.

She will now be hoping for a narrow majority for a centre-right coalition in parliament with the pro-business Free Democrats, with whom she ran Germany from 2009 to 2013, or the traditionally left-leaning Greens.

Commentators say it has been a lacklustre campaign which apart from the migrant issue produced few divisive issues.

One new development though is the rise in support for smaller parties including the AfD, which is set to become the most right-wing party in parliament for 60 years.

Pre-election polls give Merkel's conservative Union bloc a lead of 13 to 17 points over the center-left Social Democrats of her challenger, Martin Schulz.

Merkel's challenger Martin Schulz (above) returned to German politics in January after years as the European Parliament's president. But he has struggled to gain traction during the campaign

There is a chance the right wing AfD can achieve a third-place finish - which would make it the lead opposition party in the next parliament. That is a prospect viewed with trepidation by many in Germany

The two are traditional rivals but have governed together in a 'grand coalition' of the biggest parties for the past four years.

Schulz returned to German politics in January after years as the European Parliament's president. But he struggled to gain traction during a campaign that centered on correcting perceived economic injustices for poorer people in Germany. He also struggled to carve out a clear dividing line with the conservatives.

Merkel is also thought to have benefited in the eyes of voters because of her foreign policy experience, which includes dealing with the European Union, tough talks with Russian President Vladimir Putin and engaging cautiously with President Donald Trump.

Polls suggest that Schulz's Social Democrats will win around or below the 23 percent they won in their worst showing yet in post-World War II Germany, in 2009.

Experts say the most likely result will see Merkel either trying to form a new alliance with other parties or pursue another 'grand coalition' with the Social Democrats. The latter party has pledged to ballot its membership on any coalition deal, which could be tricky if it performs badly.

There are few substantial policy differences between the four parties that could become part of the next government.

In office Merkel dropped military conscription, accelerated Germany's exit from nuclear power, embraced the Social Democrats' demand for a national minimum wage and, in June, cleared the way for parliament to legalize same-sex marriage.

Schulz says he still hopes to win over undecided voters, arguing that Merkel has no vision for the future.