Angela Merkel's ruling CDU party has been beaten into third place by an anti-immigrant and anti-Islam party in elections in a north-eastern German state, TV exit polls suggest.
The Alternative fuer Deutschland (AfD) party took 21.4% of the vote behind the centre-left SPD's 30.2%.
The German chancellor's CDU was supported by only 19.8% of those who voted, according to the exit polls.
The vote was seen as a key test before German parliamentary elections in 2017.
Before the vote in Mecklenburg-West Pomerania, all of Germany's other parties ruled out forming a governing coalition with the AfD.
However, the party's strong showing could weaken Mrs Merkel ahead of the national elections next year.
Mecklenburg-West Pomerania, in the former East Germany, is where the chancellor's own constituency is located.
Under her leadership, Germany has been taking in large numbers of refugees and migrants - 1.1 million last year - and anti-immigrant feeling has increased.
The AfD, initially an anti-euro party, has enjoyed a rapid rise as the party of choice for voters dismayed by Mrs Merkel's policy.
But its political power is limited and critics accuse it of engaging in xenophobic scaremongering.
The CDU has been the junior coalition partner in Mecklenburg-West Pomerania since 2006 and is likely to remain in the governing coalition. However, its 19% in the election is its worst ever result in the state, German broadcasters said.
BBC Berlin correspondent Damien McGuinness says that following her political embarrassment, Mrs Merkel will now come under greater pressure to change her welcoming position on refugees.
Addressing supporters, local AfD leader Leif-Erik Holm said: "Perhaps this is the beginning of the end of Angela Merkel's chancellorship today."
Mrs Merkel, who is in China for the G20 summit, told Bild newspaper on Saturday: "We did not reduce benefits for anyone in Germany as a result of the aid for refugees. In fact, we actually saw social improvements in some areas.