Voters punished Chancellor Angela Merkel's conservatives in three German regional elections, giving a thumbs-down to her open-door refugee policy and turning in droves to the anti-immigrant Alternative for Germany (AfD).
Ms Merkel's Christian Democrats (CDU) lost out in two out of the three regional elections.
The result is a big setback for Ms Merkel, who has led Europe's biggest economy for a decade, and could narrow her room for manoeuvre as she tries to convince her European Union partners to seal a deal with Turkey to stem the tide of migrants.
Ms Merkel's CDU lost ground in all three states - Baden-Wuerttemberg and Rhineland-Palatinate in the west and Saxony-Anhalt in the east - which were together widely seen as offering a verdict on her liberal migrant policy.
"These results are a serious rebuke for Merkel and the most pronounced protest vote we've seen so far," said Holger Schmieding, an analyst at Berenberg Bank.
The result in the two western states was the worst-case scenario for Ms Merkel, who has staked her legacy on her decision to open Germany's doors to over one million migrants last year.
But she still looks set to run for a fourth successive term as chancellor, with no real challenger for the right to lead her party into next year's federal election.
"The result will increase the noise within the CDU and constrain the government's options on migrants and Greece, but Ms Merkel's chancellorship is not at risk," said Carsten Nickel at Teneo Intelligence.
Responding to voters' fears, she has promised to stem the flow of migrants to Germany, and is trying to convince Turkey to help - and other EU partners to share the burden. In the last few weeks, the numbers of migrants entering Germany have fallen.
With a high turnout in all the votes, the AfD, already represented in five of Germany's 16 regional assemblies, succeeded in entering three more.
Its support was strongest in Saxony-Anhalt, where it grabbed 24.2% of the vote behind a diminished CDU showing, surpassing even the Social Democrats (SPD), Ms Merkel's coalition partner in Berlin, ZDF television projections indicated.
With campaign slogans such as "Secure the borders" and "Stop the asylum chaos", it was the first time the AfD had come as high as second in any state.
"We have fundamental problems in Germany that led to this election result," said AfD chief Frauke Petry.
The AfD's rise, which has coincided with strong gains by other European anti-immigrant parties including the National Front in France, punctures the centrist consensus around which the mainstream parties have formed alliances in Germany, and may embolden more European leaders to challenge Ms Merkel on the migrant issue.