An elector casts his ballot in Rhineland-Palatinate state elections in Trier, Germany, March 13, 2016. Simon Hofmann/Getty Images

As Germans head to the polls in three states Sunday, Chancellor Angela Merkel is facing the biggest electoral test of her third term in office yet. Merkel has seen her popularity plummet after allowing more than 1 million refugees and migrants fleeing war and poverty access into Europe's largest economy to apply for asylum. Now, surging support for the populist anti-immigrant party Alternative für Deutschland (AfD, Alternative for Germany) at the state level could shake up German politics and erode support for Merkel's governing Christian Democratic Union, the mainstream conservative party, nationwide.

"In every one of these elections, the performance of the AfD will be key in determining what constellations are possible," Torsten Krauel, chief commentator for German daily Die Welt, wrote in a front-page editorial earlier this year.

Sunday's vote in will be the first true indicator of how Merkel's open-door refugee policy has affected support for her party. Germans will be voting for minister-presidents (the equivalent of governors) from six political parties jostling for seats in the state parliaments of Saxony-Anhalt, Baden-Württemberg and Rhineland-Palatinate. Last fall, public polls indicated that Merkel's CDU was a sure winner in all three states. That's no longer the case. Polling data published by Politbarometer for German state broadcaster ZDF suggest the CDU is still likely to retain its dominance in Saxony-Anhalt, in the former East Germany, but will lose its majority in the biggest prize of all, Baden-Württemberg, a prosperous state of 10.7 million in southwest Germany with an economy larger than Poland's. In Rhineland-Palatinate, the polls show the CDU in a tight race with its current left-of-center coalition government partner, the Social Democratic Party.

The AfD was polling at about 5 percent last fall, but it has since seen a rise in support as part of a voter backlash against Merkel's refugee policy. A recent poll for broadcaster ARD showed support for the AfD is at 19 percent in Saxony-Anhalt, where the refugee crisis has dominated the debate despite a minimal impact on the eastern state. If that support remains true on Election Day, AfD will be the third-strongest party in the state after Merkel's CDU and the Communist-rooted Left party.

"Saxony-Anhalt only has 4,000 refugees at this point. The uptake of refugees here has worked very well, more people are volunteering to help than demonstrating against them on the streets," Wolfgang Renzsch, a political science professor at the University of Magdeburg, recently told the Local. "But the refugees are a reason for people to feel afraid, even if they aren't a real danger."

AfD also is expected to make significant gains in the two western states and enter both state parliaments for the first time, with 13 percent projected support in Baden-Württemberg and 9 percent in Rhineland-Palatinate. Under German electoral law, winning 5 percent or more of the popular vote ensures parliamentary representation. The AfD could gain as many as eight seats in state parliaments, up from its current five. Though the party does not hold any seats in Germany's federal parliament, Bundestag, Matthias Kortmann, a politics professor at the Ludwig Maximilian University of Munich, said victories at the state level could propel the AfD to break through in next year's nationwide vote, according to USA Today.

For the past decade, Merkel has dominated German politics at the national level as the chancellor, with the major parties in accord on key issues, like eurozone bailouts and even refugees. But for the first time in years, Germany's normally agreeable politics looks poised to be more divisive, beginning with Sunday's elections.

"If we don't see success in limiting the tide of refugees, we could have a grassroots political tremor in Germany," a senior government official, who declined to be named because of the sensitivity of the issue, recently told Reuters. "If Merkel doesn't deliver, you could see the AfD approaching 20 percent in the polls."

Final results from Sunday's elections in Saxony-Anhalt, Baden-Württemberg and Rhineland-Palatinate will be posted on each of the state parliament websites within days of voting.