German Chancellor Angela Merkel has been re-elected for a fourth term while nationalists have made a historic surge in federal elections.
Her conservative CDU/CSU bloc has seen its worst result in almost 70 years but will remain the largest in parliament.
Its current coalition partner, the social democratic SPD, says it will go into opposition after historic losses.
The nationalist AfD has won its first seats and is set to be the third party, a result that sparked some protests.
Dozens of demonstrators gathered outside the right-wing, anti-Islam party's headquarters in Berlin, some with placards saying "Refugees are welcome".
Protests were also held in Frankfurt and Cologne.
What does the result mean for Mrs Merkel?
While her alliance has remained the largest party, it is the worst result for the alliance between the Christian Democrat (CDU) and the Christian Social Union (CSU) since 1949, when national elections were held in Germany for the first time after World War Two.
Addressing supporters, Mrs Merkel, who has been in the job for 12 years, said she had hoped for a "better result".
She added that she would listen to the "concerns, worries and anxieties" of voters of the Alternative for Germany (AfD) in order to win them back.
Mrs Merkel also said her government would have to deal with economic and security issues as well as addressing the root causes of migration - one of the main reasons behind the AfD's result.
"Today we can say that we now have a mandate to assume responsibility and we're going to assume this responsibility calmly, talking with our partners of course."
The result is disastrous for Mrs Merkel, BBC Berlin correspondent Jenny Hill says.
The chancellor is being punished, our correspondent adds, for opening Germany's door to almost 900,000 undocumented refugees and migrants.
What are her coalition options?
The Social Democrats (SPD), led by Martin Schulz, also had its worst election result since 1949. He said the outcome meant the end of the "grand coalition" with Mrs Merkel's alliance.
"It's a difficult and bitter day for social democrats in Germany," Mr Schulz told supporters. "We haven't reached our objective."
Chancellor Merkel has won a fourth term, but will need new coalition partners | Getty Images
With the possibility of an alliance with the SPD rejected, Mrs Merkel's options are narrow, and the process of forming a new coalition could take months.
Six parties will be in the German parliament for the first time since the 1950s.
The most likely scenario is of a "Jamaica" coalition, so-called because of the colours of Jamaica's flag. It includes the black CDU/CSU, the yellow, business-friendly Free Democrats (FDP) - who are returning to parliament after a four-year hiatus - and the Greens.
It is not a marriage made in heaven, as the Greens want to phase out 20 coal-fired power plants and the FDP disagree, but it is the only formation that would guarantee enough seats in the new Bundestag, German broadcaster ZDF says.
All parties have rejected working with the AfD.
More at BBC News