Germany's CDU, the party of Chancellor Angela Merkel, has described the party's historic losses in Berlin state elections as a "bitter defeat".
It was ousted from the state coalition with the centre-left Social Democrats.
Meanwhile right-wing anti-migrant party Alternative for Germany (AfD) will enter the state parliament for the first time with 14% of the vote.
Mrs Merkel's popularity has waned since her decision last year to allow more than a million migrants into Germany.
The CDU won 17.6% of the vote - its worst-ever result in Berlin.
It is the party's second electoral blow this month, having been pushed into third place by AfD in Mecklenburg-Western Pomerania. AfD will now be represented in 10 out of 16 state parliaments.
Mrs Merkel told reporters that, if she could, she would turn the clock back many years to prepare the government better for the influx of migrants and refugees.
The Social Democrat SPD emerged as the strongest party with about 22%, in spite of losing almost 7% of their voters, and said it would hold talks on forming a coalition with all parties except AfD. It is expected to drop the CDU as a coalition partner in favour of the left-wing Die Linke and the Greens.
AfD co-chairman Joerg Meuthen said the party was strongly positioned for next year's national elections and colleague Beatrix von Storch predicted that it would become the third-largest political force in Germany in 2017.
"We're witnessing in 2017 Angela Merkel's battle for survival," she said.
Germany's changing politics - BBC's Jenny Hill in Berlin
It's being described as the "Merkel malaise".
For the second time in a month, Angela Merkel's conservatives have suffered a humiliating defeat at the regional ballot box.
Both votes are widely seen as a verdict on Mrs Merkel's refugee policy. But the result also reflects growing disillusionment with Germany's establishment parties. The Social Democrats may have won the election here but they lost voters; their success is being described as the weakest victory of all time.
Germany's political landscape is changing. The anti-migrant, anti-Muslim rhetoric of AfD resonates with the electorate. The party is now almost certain to win seats in the national parliament next year which could complicate coalition building. Commentators predict the start of a more complex politics.
And many blame Angela Merkel. For the first time, the chancellor's political future feels uncertain. Don't expect her to stand down any time soon. But, increasingly, her own party views her as irrevocably tainted by her refugee policy. She needs to convince them - and the public - that she's in control.
Angela Merkel acknowledged that the refugee crisis would change Germany. Arguably, the most seismic shift thus far is at political level. And Mrs Merkel is on shaky ground.
Bavarian Finance Minister Markus Soeder, from the CDU's sister party CSU, was quick to call it the "second massive wake-up call" in two weeks.
"A long-term and massive loss in trust among traditional voters threatens the conservative bloc," he told the Bild daily, adding Ms Merkel's right-left national coalition had to win back support by changing course on its immigration policy.
Mrs Merkel appeared to shift her position on migration at the weekend when she distanced herself from a phrase she used at the height of the influx of migrants at the end of August 2015.
"Wir schaffen das" (we will manage it) was at the time an expression of sentiment that many would recognise, she told a business website on Saturday. But she now saw it as dated and too much had been read into it: "so much so that I'd prefer not to repeat it because it's become something of a simplified motto, an empty formula".
Sunday's election in Berlin, a city-state of 3.5 million people, was dominated by local issues including poor public services, crumbling school buildings, late trains and a housing shortage, as well as problems in coping with the migrant influx.
What went wrong? Media on failings of mainstream politics
"Protest election turns capital into tatters," proclaims daily tabloid Bild, which describes Berlin's SPD mayor as Germany's "weakest election winner of all time".
The rise of the right-wing AfD is driven by voters who feel "forgotten and marginalised", says Frankfurter Allgemeine Zeitung.
On the fate of the chancellor, Spiegel says that while her CDU "crashed", she is likely to be able to blame local factors, rather than anger at her welcoming stance on migrants. Sueddeutsche Zeitung sees a party revolt as unlikely: "No-one knows how things will carry on without her."