BERLIN — Angela Merkel won a fourth term as chancellor in elections on Sunday, placing her in the front ranks of Germany’s postwar leaders, even as her victory was dimmed by the entry of a far-right party into parliament for the first time in over 60 years, according to preliminary results.
The far-right party, Alternative for Germany, or AfD, got about 13 percent of the vote — nearly three times the 4.7 percent it received in 2013 — a significant showing of voter anger over immigration and inequality as support for the two main parties sagged from four years ago.
As Merkel and her center-right Christian Democrats won, the center held, but it was weakened. The results made clear that far-right populism — along with anxieties over security and national identity — was far from dead in Europe.
They also showed that Germany’s mainstream parties were not immune to the same troubles that have afflicted mainstream parties across the Continent, from Italy to France to Britain.
“We expected a better result, that is clear,” Merkel said Sunday night. “The good thing is that we will definitely lead the next government.”
She said she would listen to those who voted for Alternative for Germany, and work to win them back “by solving problems, by taking up their worries, partly also their fears, but above all by good politics,” she said.
But her comments seemed to augur a shift to the right and more of an emphasis on controls over borders, migration and security.
Despite her victory, Merkel and her conservatives cannot rule alone, making it probable that the chancellor’s political life in her fourth term will be substantially more complicated.
The shape and policies of a new governing coalition will involve weeks of painstaking negotiations. Smiling, Merkel said Sunday night that she hoped to have a new government “by Christmas.”
The center-left Social Democrats, Merkel’s coalition partners for the last four years, ran a poor second to her center-right grouping, and the Social Democrats announced Sunday evening that the party would go into opposition, hoping to rebuild its political profile.
But the step would also make sure that the AfD stays on the political sidelines and does not become the country’s official opposition.
The Alternative for Germany nonetheless vowed to shake the consensus politics of Germany, and in breaking a postwar taboo by entering parliament, it already had.
Alexander Gauland, one of AfD’s leaders, told party supporters after the results that in parliament: “We will go after them. We will claim back our country.”
To cheers, he said: “We did it. We are in the German parliament and we will change Germany.”
Burkhard Schröder, a Düsseldorf AfD member since 2014, was ecstatic. “We are absolutely euphoric here,” he said. “This is a strong victory for us that has weakened Angela Merkel.”
Up to 700 protesters gathered outside the AfD’s election night party, chanting slogans like “All of Berlin, hate the AfD.”
“It’s important to show that it’s not normal that a neofascist party got into the German parliament,” said Dirk Schuck, 41, a political scientist at the University of Leipzig.
While both Merkel and the Social Democrats lost significant voter support from 2013, her victory vaults her into the ranks of Konrad Adenauer and Helmut Kohl, the only postwar chancellors to win four national elections.
The election is a remarkable capstone for Merkel, 63, the first East German and the first woman to become chancellor.
It also represents a vindication of her pragmatic leadership and confidence in her stewardship of Europe’s largest economy and of the European Union itself in the face of populism, challenges from Russia and China and uncertainty created by the unpredictable policies of President Donald Trump.
Even so, the advance of the far right was a cold slap for her and the Christian Democratic Union, or CDU. The AfD made particular inroads in the former East Germany but also in Bavaria, where Merkel’s sister party, the Christian Social Union, or CSU, has long ruled but lost some 10 percent of its vote over 2013. Horst Seehofer, the CSU leader, said: “We made the mistake of having the right flank open.”
A critic of Merkel’s immigration policies, he added: “We have a vacuum on the right, we will close it with politics that ensure Germany remains Germany.”
The late leader of that party, Franz-Josef Strauss, said in 1986 that the party should allow no one to run to their right. “To the right of us there is only the wall,” he said.
Seehofer echoed that insight Sunday night. But others cautioned calm.
“We will remember today in history,” said Thomas Heilmann, a member of parliament from the CDU, in an email interview. “As in the U.S., hate became part of politics. The CDU cannot and must not match this attitude.”
Governing Germany “will become more difficult,” Heilmann added. “It is definitely not a good day for Germany and most likely not good for Europe either.”
Clemens Fuest, the director of IFO, the Institute for Economic Research in Munich, said that the results showed wide concern about “security, immigration and possible challenges to the German economic model, like globalization,” he said.
These mattered more than the Social Democrats’ concentration on injustice and inequality, he said.
The other parties should make less of the AfD showing “and instead ask themselves what questions they have not answered” — questions of borders, migration and the pressures on Germany to do more to prop up other countries of the EU.
Merkel’s conservative bloc won some 32.9 percent of the vote, sharply down from 41.5 percent in 2013 , the early results showed.
The Social Democrats slumped to 20.8 percent, a new postwar low, down from 25.7 percent four years ago.
If the Social Democrats hold to their intention to go into opposition, Merkel will be faced with an unusually difficult task to form a working coalition.
Given the numbers, it would seem that she will have to cobble together her own Christian Democrat-Christian Social Union bloc together with two other parties.
The potential new partners inhabit virtually opposite poles on the political spectrum — the pro-business Free Democrats, who won some 10.4 percent of the vote, and the left-leaning pro-environment Greens, who won about 9 percent. At the Christian Democrat headquarters, Frank Wexler, a Berliner, called the results “a bit depressing.”
Grand coalitions had allowed the small parties to gain ground, he said. “The main parties are getting smaller,” Wexler said. To counteract the AfD, he said, “We need to address the issue of strengthening the borders.”
But Wexler said he was most disturbed by the AfD’s hostility to the European Union. “This is what Germany needs to do — be a strong leader in Europe.”
But Hans Kundnani, an expert on Germany with the German Marshall Fund, said that Merkel might fail to create the three-party coalition, putting the Social Democrats under great pressure to join another coalition rather than forcing new elections.
To Kundnani, “the big shock is not the AfD,” but the loss of support for Merkel’s conservatives and the increasing fragmentation of German political life.
Germany has a complicated system of proportional representation, in which each voter casts one ballot for their local representative and one ballot for a political party. Those elected locally get their seats.
But the parties’ overall share of seats in parliament is determined by the percentage of votes they win. Turnout was 75.9 percent, up from 71.5 percent in 2013, but a long way from the 90 percent turnout figures of the 1980s. Though initially reluctant to run for a fourth term, Merkel threw herself into the campaign, especially as the government has brought some order to the chaos engendered in 2015 when she threw the country’s borders open to refugees and migrants.
But the backlash over the migrant crisis, coupled with her long period in office and the wishy-washy nature of grand coalition politics, has led to more support for the more extreme, anti-European parties like the AfD and The Left, the heir of the East German Communist Party, which came in third in 2013 and won about 9 percent of the vote Sunday.
In Dresden, Gert Frülling, 75, a retiree, declined to divulge his party preference, but made it clear that he was sympathetic to some of the Alternative for Germany’s proposals.
“It all happened too fast,” he said, referring to the time after Germany’s reunification. “Dresden is a city of bureaucrats and soldiers, and they dumped all this multiculturalism on us at once. I know we had to change, but it should have happened more gradually.”
He said it would be wrong for other parties to refuse to work with the AfD in Parliament. “If they present good ideas,” he said, “I think it’s not fair to boycott them.”
In Neustadt, a gentrifying area of Dresden, Rebecca Klingenburg, 20, was clearly excited to be one of an estimated 3 million first-time voters.
“One gets to decide on what country one wants to live,” she said. A mechanical-engineering student, Klingenburg said she was voting to maintain Germany’s orientation toward Europe, at a time of rising nationalism.
“I learned four languages in school,” she said. “I want to make sure that we stay internationally oriented.”
Reporting was contributed by Jack Ewing, Edmund Heaphy and Victor Homola from Berlin and Christopher F. Schuetze from Dresden.