Voters punished Chancellor Angela Merkel's conservatives in three German regional elections on Sunday, giving a thumbs-down to her open-door refugee policy and turning in droves to the anti-immigrant Alternative for Germany (AfD).
The result is a big setback for 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.
Merkel's Christian Democrats (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 Merkel's 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 Merkel, who has staked her legacy on her decision to open Germany's doors to over 1 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 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 percent of the vote behind a diminished CDU showing, surpassing even the Social Democrats (SPD), 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 Merkel on the migrant issue.
The CDU's leader in Saxony-Anhalt pointed the finger squarely at Merkel for his party's losses.
"The issue that has brought the AfD into parliaments across Germany can't be ignored on a federal level any more. We need solutions," Reiner Haseloff told ARD television.
Charlotte Knobloch, former head of Germany's Central Council of Jews, bemoaned a "massive shift to the right".
"If voters follow the call of right-wing populists and extremists to such an extent, it is a failure of the democratic parties," she said.
In Baden-Wuerttemberg in the southwest, the Greens for the first time became the strongest party in a state, with 31.1 percent of the vote, ZDF television projections indicated.
The state was a CDU stronghold for more than 50 years before turning to a Green-led coalition with the SPD in 2011 after the Fukushima nuclear disaster in Japan, and CDU support fell by another 12 percentage points on Sunday.
Also damaging for the CDU was the result in Rhineland-Palatinate, the home of former chancellor Helmut Kohl.
There, the CDU's Julia Kloeckner, who had positioned herself as a future candidate to succeed Merkel, failed to unseat SPD state premier Malu Dreyer.
It was the only bright spot for the SPD, the biggest loser overall. In Saxony-Anhalt, its support almost halved and in Baden-Wuerttemberg it sank by more than 10 percentage points.
Asked if the SPD's weak showing in those two states would trigger questions about SPD leader Sigmar Gabriel's future, deputy party chairman Ralf Stegner said: "No, not at all."
It is still unclear which coalitions will take power in each state, but the splintered vote opens the prospect of deep changes to the political landscape.