Green Party leaders Robert Habeck, left, and Anton Hofreiter, right, celebrate after polls closed Sunday. (Kerstin Joensson/AP)

Voters in the southern German heartland of Bavaria dealt a stinging blow Sunday to Chancellor Angela Merkel’s conservative allies, humbling a party that has governed for decades while boosting either political flank in an election defined by polarized opinions about immigration.

The dramatic loss of support for the Christian Social Union (CSU), sister party to Merkel’s Christian Democratic Union (CDU), scrambled politics in a region that has been one of the most politically stable in Europe. 

Votes for the Bavarian state parliament have rarely been competitive in modern lifetimes, with the CSU crafting a “laptops to lederhosen” approach that coupled its support for high-tech industry with its embrace of traditional culture. For decades, the CSU came as close as Western Europe gets to a state party. 

That changed Sunday, with voters in the affluent region defecting en masse and redistributing their support to both ends of the political spectrum. The result won’t end the CSU’s 61-year streak in power, but it forces the party to bargain for partners. And it will almost certainly add to the strain on an already beleaguered Merkel, whose other coalition partner, the center-left Social Democratic Party (SPD), was also punished Sunday. The combined share of the vote won by the SPD and CSU was down more than 20 percent since the last election, in 2013.

“It’s an earthquake,” said Thomas Kleine-Brockhoff, who leads the German Marshall Fund’s office in Berlin. “People are dissatisfied with this so-called grand coalition. This is not the way they want things.” 

The results showed the CSU falling from nearly half the vote five years ago to 37.2 percent. The Green Party surged to second place, with 17.5 percent, and the far-right Alternative for Germany is set to enter the Bavarian parliament for the first time, with 10.2 percent.

The results sent a stream of green confetti raining down on jubilant Greens activists at the party’s election-night headquarters. There was a similarly exuberant celebration among dirndl- and lederhosen-clad AfD supporters.

It was a different story for the CSU, with stern-faced Bavarian state Premier Markus Söder telling a quiet gathering of the party faithful that the result “isn’t easy.”

“We will accept it with humility. We will need to learn from it. We will need to analyze it precisely,” he said.

Söder tried to put a brave face on the outcome, insisting that the CSU will continue to lead the state’s government, despite a result that is the second-worst in the party’s history. The CSU, he said, “isn’t only the strongest party, but it received a clear mandate to govern.”

The CSU has ruled out a coalition with the AfD, but could strike a deal to govern with one or more smaller conservative parties — or perhaps with the Greens.

The election was closely watched in Germany, and the results appear to fit a pattern seen both within the country and across the continent. Traditional centrist parties that once flirted with absolute majorities of the vote are withering. Niche and politically extreme parties are gaining as the electorate fragments into ever finer shards. 

At the national level, that has meant a record seven parties in the parliament since elections last year, and a deeply dysfunctional governing coalition of three. 

The Bavarian result, said Kleine-Brockhoff, confirms long-known struggles for Europe’s center-left. But it also points to the difficulties ahead for the continent’s center-right. “We’re looking at the slow fragmentation of Christian conservatism,” he said.

Sunday’s result is likely to reverberate loudly in Berlin, where it will be seen as yet another blow to Merkel’s once-mighty fusion of her CDU with its Bavarian sister.

Since the CDU/CSU faction disappointed in last year’s vote, Merkel has seen her authority diminish at home and abroad as she struggled to cling to a job she has held for 13 years.

Yet the CSU’s Sunday humiliation could also make Merkel’s life easier in one respect: Her primary rival within the government, Interior Minister and CSU leader Horst Seehofer, is likely to face calls to resign. 

Seehofer has provoked repeated clashes with his boss this year over immigration, and he nearly toppled the government this summer. His defiance of Merkel was widely seen as a deliberate CSU strategy to prove to Bavarian voters that the party could be just as tough on borders and security as its insurgent rivals in the AfD. 

But if that was the aim, the effort fell flat. The CSU failed to pry right-wing voters back from the AfD, while more centrist and liberal supporters defected to the progressive-minded Greens. 

“People who voted for them for 60 years aren’t voting for them anymore. And it’s because of their polarizing and inhumane politics,” said Paul Knoblach, a 12th-generation Bavarian farmer. 

Knoblach was among the CSU’s longtime supporters and had volunteered for its campaigns. But on Sunday, at age 64, he ran for the state parliament for the first time. And he did it as a Green, a party that more than doubled its share of the vote Sunday by focusing on drawing a clear contrast with right-wing parties on the issue of refugees.

“If you follow the media, you get the impression that everyone’s turning to the right, to racism. But it’s not like this. Normal people just haven’t been loud enough,” said Eva Peteler, a Bavarian pro-refugee activist. “Now we’re getting louder.” 

The AfD, known for its incendiary anti-immigrant and anti-Muslim rhetoric, will also be getting louder in Bavaria. The last time Bavarians voted, in 2013, the party had just launched. Now the AfD will be in the parliament, putting it in 15 out of 16 German state legislatures. It is on course to join that last one later this month, with elections in the state of Hesse.

“The results show that trying to trick voters doesn’t pay,” said AfD leader Alice Weidel, referring to the CSU’s rightward Bavarian shift.

The other big loser Sunday, the SPD, saw its vote halved since the last election, according to projected results, with about 10 percent. Party leader Andrea Nahles blamed “the poor performance of the grand coalition in Berlin.”

The national government has been paralyzed this year by infighting between Seehofer and Merkel. The CSU was also split, with Seehofer and Söder often feuding. 

In an interview with national broadcaster ZDF on Sunday night, the interior minister deflected when asked whether he would step down. But he said he would take his share of the blame for Sunday’s outcome as long as others do, as well — a clear reference to Söder.

“As a party leader, I bear responsibility for this result,” Seehofer said. “But it’s a joint responsibility.”

Close Merkel ally and CDU General Secretary Annegret Kramp-Karrenbauer, meanwhile, seemed to chide her CSU friends for emphasizing the problems with immigration when they could have been touting their successes.

The CSU, she said, had been “unable” to shift attention to “the very good situation of the state’s security, the excellent position of its economy and job market.” 

The result, she said, was “a warning.” 

Luisa Beck contributed to this report.