BERLIN — For the past decade, German politics has been a relatively dull affair, with Chancellor Angela Merkel dominating at the national level and the major parties in agreement on all the big issues, from euro zone bail-outs and refugees to the phasing out of nuclear energy.

But that may change this year when five of Germany’s 16 states hold elections in the build-up to the next federal vote next year.

Not only is Ms Merkel looking more vulnerable than ever before because of her welcoming stance towards the hundreds of thousands of refugees fleeing war in the Middle East, but the rise of the anti-immigrant Alternative for Germany (AfD) party has injected an element of surprise into the political landscape.

Add to that an unprecedented splintering of the electorate, which means that six parties have a legitimate shot of entering most state parliaments, and Germany’s normally cosy, consensual politics begins to look a bit less predictable, and potentially more divisive, than it has in a long time.

The wild card is the threat of an attack by Islamist extremists on German soil, a risk highlighted on New Year’s Eve when authorities received a tip that Iraqi and Syrian nationals were planning suicide bombings at train stations in Munich. It could be fatal for Ms Merkel, officials in Berlin acknowledge in private, if such an attack were carried out successfully by people who entered Europe with the flood of migrants, as was the case with two of the men involved in the November attacks in Paris.

Even if Germany is spared such a horror, the refugee crisis will continue to dominate the political debate this year, polarising voters and emboldening Ms Merkel’s opponents on the right and left.

So far, the most damaging attacks have come from her conservative sister party, the Bavarian Christian Social Union (CSU).

“If we don’t see success in limiting the tide of refugees, we could have a grassroots political tremor in Germany,” said one senior government official, who declined to be named because of the sensitivity of the issue. “If Ms Merkel doesn’t deliver, you could see the AfD approaching 20% in the polls,” the official predicted.

Currently, the AfD is polling between 8% and 10%, about double the 4.7% the party won in the last federal election in 2013, when it narrowly failed to clear the 5% mark needed to enter the Bundestag. That seems relatively harmless if you compare it to other like-minded parties across Europe, such as the National Front in France, the Freedom Party in Austria or the Danish People’s Party, which enjoy more than twice as much support.

But the AfD’s rise looks more significant when one considers that it has occurred against a backdrop of infighting and financial trouble within the party that might have crushed it. In the past half-year, the party has weathered the departure of its founder, embarrassing slurs about African reproductive habits from one of its leading politicians, and a party-financing law from the government that threatened to strip bare its coffers.

In response to the new law, the AfD asked its supporters for donations and raised about €2m in just three weeks, a testament to its drawing power.

In three state elections that are due to be held in March, the AfD’s newfound strength will be on stark display. It is on track to win 7% in the western states of Baden-Wuerttemberg and Rhineland-Palatinate and about twice that in Saxony-Anhalt in the east.

“In every one of these elections, the performance of the AfD will be key in determining what constellations are possible,” Torsten Krauel wrote in a front-page editorial in German daily Die Welt last week.

Ms Merkel could yet emerge as the big loser from the new German political landscape if she is unable to stem the tide of refugees in the months ahead.