MUNICH - German Chancellor Angela Merkel’s arch-conservative CSU allies suffered historic losses in Bavaria state elections Sunday, dealing a blow to her fragile three-party coalition government.

The Christian Social Union (CSU) scored 35 percent, a humiliating 12-point drop from four years ago in the wealthy Alpine state it has ruled almost single-handedly since the 1960s.

The poor result means it loses its absolute majority and must scramble for coalition allies - either the conservative Free Voters (11 percent) or long-time ideological foes the Greens, who were the big winners with a record 18-19 percent support.

State premier Markus Soeder, 51, conceded the result was “painful”, while CSU party chief and national Interior Minister Horst Seehofer said “it was not a nice day for us”.

The anti-immigration Alternative for Germany (AfD), which rails against Muslims and demands that “Merkel must go”, won 11 percent and entered the 15th of Germany’s 16 state assemblies.

Merkel’s other national governing partner, the over 150-year-old Social Democrats (SPD), halved their ballot box support to just below 10 percent, ceding the position of Bavaria’s second biggest political force to the Greens.

“Debacle for CSU and SPD,” ran the online headline of Bild daily, while Der Spiegel called it a “bitter defeat” for Bavaria’s traditional ruling party.

For Merkel, in power for 13 years, the Bavaria election spells a new headache just over half a year since she managed to forge a fragile “grand coalition” with the CSU and the reluctant SPD.

The “bitter” losses in Bavaria reflect voter dismay over recent coalition infighting in Berlin, conceded the CDU’s general secretary Annegret Kramp-Karrenbauer.

She said this “must serve as a warning for the German CDU” ahead of another dangerous state election, in Hesse state, two weeks from now.

SPD leader Andrea Nahles conceded a “bad result for the SPD ... and for all mainstream parties” that she said was partially due to “the bad performance of the grand coalition in Berlin”.

The AfD’s Alice Weidel, meanwhile, jubilantly declared that Merkel’s government “is not a grand coalition but a mini coalition” and demanded she “clear the way for new elections”.

The Bavaria poll result shattered old certainties for the CSU, which had long dominated politics in the state known for its fairytale castles, Oktoberfest and crucifixes on classroom walls.

It reflects shifting voter preferences at the expense of mainstream parties in a state which mixes rural Catholic conservative areas with cosmopolitan urban centres home to global companies like Siemens and BMW.

Since Germany’s mass migrant influx of 2015, the CSU has hardened its folksy brand of beerhall politics with an increasingly aggressive anti-immigration and law and order rhetoric.

At the national level, Seehofer became Merkel’s harshest internal critic, echoing the AfD’s rhetoric about the more than one million refugee and migrant arrivals. The poll result Sunday showed that the tactic and Seehofer’s brinkmanship in Berlin have backfired badly. Those Bavarian voters most worried about immigration and cultural identity chose the AfD, while those turned off by the harsh new tone drifted to the Greens. Seehofer, 69, has already declared he intends to stay on and “complete my mission” as interior minister.

A poll by public broadcaster ARD showed that most voters blame Berlin-based politicians for the CSU’s poor performance in Bavaria.

While 56 percent saw Seehofer as the chief culprit, 24 percent pointed to Merkel, followed by Soeder at 8 percent. The Bavaria election served as a painful bellwether of the national mood at a time when political commentators speak of the dawn of the Merkel era. Across Germany, support for the CDU-CSU conservative union dropped to an all-time low of 26 percent, according to an Emnid poll for Bild am Sonntag newspaper.

In second place, Germany-wide, were the SPD and Greens, neck-and-neck at 17 percent each, followed by the AfD at 15 percent.