BERLIN/MUNICH (Reuters) - Chancellor Angela Merkel’s Bavarian allies suffered their worst election result since 1950 on Sunday, bleeding votes to the far-right and the ecologist Greens in a setback that raised tensions within Germany’s crisis-prone national government.

The Christian Social Union (CSU) won 37.3 percent of the vote, preliminary results showed, losing its absolute majority for only the second time since 1962 - an outcome sure to stoke infighting in the conservative party, already a difficult partner for Merkel in Berlin.

“Of course today is not an easy day for the CSU. We did not achieve a good result,” Bavarian premier Markus Soeder told a gathering of his party. “We accept the result with humility,” he said, adding that the CSU nonetheless wanted to form a stable government as soon as possible.

The result, which saw the pro-immigration Greens come second and the far-right Alternative for Germany (AfD) enter the state assembly for the first time, means the CSU will need to form a coalition - a humiliation for a party used to ruling alone.

The Greens, who more than doubled their share of the vote to 17.8 percent, attracted support from more liberal CSU voters and from those who traditionally vote for the left-leaning Social Democrats (SPD), who won just 9.5 percent.

“The political earthquake was in Bavaria, but the aftershocks will be felt in Berlin ... Talk will increase ever more about the end of the Merkel era,” said Fred Kempe, president of the Washington-based Atlantic Council think-tank.

Without naming Merkel, SPD leader Andrea Nahles said the “poor performance” of the federal government in Berlin, where the SPD is in a coalition with the conservatives, was one of the reasons for her party’s weak showing in Bavaria. “It’s clear that something has to change,” she said.

Slideshow ( 17 images )

THORN IN MERKEL’S SIDE

CSU leader Horst Seehofer has been a thorn in Merkel’s side since her 2015 decision to open Germany’s borders to more than 1 million migrants, gradually shifting his party to the right in an ultimately futile effort to counter the rise of the AfD.

Michael Weigl, political scientist at the University of Passau, said personal attacks on Merkel by Seehofer - who is the federal interior minister - and his hard-line rhetoric against asylum seekers were to blame for the CSU’s weak result.

“This created a political climate of polarization from which the Greens and the AfD benefited the most, with their clear stances on immigration,” Weigl said. “For the CSU, this strategy backfired.”

Asked if he would resign as CSU leader, Seehofer told broadcaster ZDF he was not ruling this out but there were many reasons for the party’s weak result which had to be analyzed.

The AfD won 10.7 percent of the vote, the preliminary results showed. The Free Voters, a protest party that is the CSU’s most likely coalition party, won 11.6 percent. The CSU has ruled out an alliance with the AfD.

Slideshow ( 17 images )

INFIGHTING

Divisions between Merkel’s Christian Democratic Union and the CSU - conservative sister parties - have widened since an inconclusive national election forced them into a coalition in March with the Social Democrats.

The Bavarian election is followed in two weeks by another test for Merkel’s conservative alliance, known as the Union: her CDU is likely to remain the largest party but lose votes in an election in the western state of Hesse, home to the financial center of Frankfurt.

The CDU then holds its annual congress in December, when Merkel will seek re-election as party chairwoman - a bid senior conservatives have backed despite the parliamentary party ousting her ally, Volker Kauder, as leader last month.

Before the Bavarian vote, Merkel urged her CDU and CSU allies to end their infighting.

Her fourth and probably final government has already come close to collapsing twice, in arguments over immigration and a scandal over a former spymaster.

Jan Techau at The German Marshall Fund of the United States think-tank described Merkel as “exhausted and weakened”.

“And yet, her strategy to keep the Union firmly in the middle does not look so silly after this result for the CSU,” he said. “Whether this temporary reprieve can hold or not will depend on the result in Hesse.”