Angela Merkel secured her fourth term as German chancellor but her victory was marred by a huge fall in her party's vote and the astounding rise of an extreme right-wing party whose nationalistic members have vowed to "hunt" Ms. Merkel in parliament.
The victory of Ms. Merkel and her centre-right Christian Democratic Union (CDU) allows her to retain her status as Europe's most powerful leader and, in the era of Donald Trump and Brexit, ensures she remains the symbol of stability and liberal Western values in a globally fractured political landscape. There is no doubt she will continue to preach the virtues of free trade, the Paris climate change deal and Germany's ability to treat migrants as equal, productive citizens.
Other aspects of her European and global role, however, might have to take a back seat to suddenly pressing domestic issues, notably stopping the rise of the Alternative for Germany (AfD), the anti-immigrant, anti-Islam, euroskeptic party that took some 13 per cent of the vote, well ahead of forecasts, making it the third-biggest party in the Bundestag, the German parliament.
"AfD presents an extraordinary challenge for Germany," Ms. Merkel said Sunday night. "We need to listen to their voters."
The AfD was born only four years ago and saw its popularity surge during the 2015-16 refugee crisis as Ms. Merkel opened Germany's borders to more than one million refugees, mostly from Syria and Afghanistan. It will become the first far-right party to sit in the Bundestag since 1960.
Christian Odendahl, chief economist in Berlin for the Centre for European Reform, said Ms. Merkel "will have to spend more political capital on domestic affairs" now that the AfD's popularity has climbed at the CDU's expense. He estimates that the AfD grabbed one million votes from the CDU.
The election result probably means that reform of the European Union and the euro zone – an idea cherished by new French President Emmanuel Macron, Ms. Merkel's closest EU ally – will be delayed as migration and refugee issues take on more prominence in Bundestag debates.
As the final polls were being tallied, the CDU and its Bavarian sister party, the Christian Social Union (CSU), were embarrassingly short of the 41.5 per cent of the vote they scored in the 2013 federal election as Ms. Merkel's appeal was dented by her own bland, play-it-safe campaign and the rise of the AfD.
Together, the CDU and CSU took only 33 per cent of the vote, exit polls said, worse than many predictions and a blow to the party's pride. The centre-left Social Democratic Party (SPD), Ms. Merkel's coalition partner in the last government, scored a dismal 20 per cent, well down from the 25.7 per cent earned in the 2013 election. "This is a disaster for the SPD," Mr. Odendahl said.
The SPD's dismal performance may cost the career of Martin Schulz, the former European Parliament president whose popularity ratings had been more or less tied with Ms. Merkel's in the spring before heading relentlessly downhill.
The big winner of the night was the AfD. When the first exit polls were published shortly after 6 p.m., AfD party members at the Traffic Club in Berlin erupted in shouts of joy and clapping and some sang the German national anthem as protesters outside called the AfD "fascists."
"We have arrived," Alice Weidel, the openly gay AfD co-leader and former investment banker, told party supporters. (The AfD opposes gay marriage.)
Her high-profile AfD colleague, Alexander Gauland, told that crowd that "the government has to buckle up. We will hunt them. We will hunt Ms. Merkel … and we will reclaim our country and our people."
One of the protesters outside the Traffic Club, Elias Koenig, a 19-year-old philosophy student, said he feared the AfD's popularity would bring nationalism and racism out of the closet. "Germans, of course, had a very bad experience with nationalism in the past," he said. "The problem with the AfD's rise is that it might make everyday racism normalized in the streets."
The AfD was going nowhere until the 2015-16 migration crisis gave it a national platform to attack Ms. Merkel's open-door policy. While the crisis has faded from view in Germany, its tactics were aimed at instilling fear of foreigners, especially those from the Middle East, among Germans. The anti-immigrant stand has attracted millions of right-wing conservative and apparently xenophobic voters across all demographic groups, especially in less wealthy eastern Germany.
The AfD is especially popular with Germans of Russian descent. Its chairwoman, Frauke Petry, has condoned the use of "firearms if necessary" to "prevent illegal border crossings" and will no doubt use the AfD's Bundestag platform to urge a clampdown on asylum seekers and seek warmer relations with Russia.
In the coming weeks, perhaps months, Ms. Merkel will try to cobble together a new coalition – German governments are always coalitions – that will almost certainly recruit both the pro-business Free Democratic Party (FDP), which took more than 10 per cent of the vote, and the Green Party, which won more than 9 per cent. The Left Party, the remnant of the East German Communist party, also made it into parliament, with close to 9 per cent, but Ms. Merkel has ruled out forming a coalition with either The Left or the AfD.
The SPD was quick to rule itself out of contention as a coalition partner because of its dismal showing. It will go into official opposition as the second-largest party while it tries to renew itself.
The makeup of the coalition will in good part determine the direction and culture of the next Bundestag. Assuming the FDP enters the coalition, it would demand control of a few key ministries for its support, including the all-important finance ministry.
The FDP's arrival in the coalition might inject the new government with a pro-business, mildly Euroskeptic philosophy that would put pressure on Ms. Merkel to cut taxes and regulation and take a hard stand on the Greek bailout. (Earlier this summer, FDP leader Christian Lindner suggested that Greece be pushed out of the euro zone, although not the European Union, until its economy recovers.)
The FDP also favours a "two-speed Europe," where the strongest countries would be invited to integrate their economic and political policies faster than the weaker ones, such as Italy, Spain, Portugal and Greece.
It is the AfD's startling presence in the Bundestag that will have the greatest impact on the debates in the Bundestag. Based on projections, the AfD will occupy close to 100 seats in the 630-seat Bundestag.
The AfD was formed in 2013 by Bernd Lucke, an economics professor who opposed the bailouts of Greece. At the time, it billed itself as a genuine Euroskeptic party, not an anti-immigrant party, and was not prone to racist outbursts. That changed during the European migration crisis.
The party was taken over by anti-immigrant nationalists and Mr. Lucke and his moderate colleagues were ousted. The sexual assaults on dozens of women by men of North African origin on Dec. 31, 2015, in Cologne fuelled the AfD's popularity rise, as did the attack a year later by an asylum seeker from Tunisia, who killed 12 people by driving a truck through a Berlin Christmas market.