BERLIN (Reuters) - Lawmakers in Germany’s eastern state of Thuringia voted a former hard-left state premier back into office on Wednesday, replacing a liberal whose election a month ago with far-right backing sent shock waves through the political establishment.

Slideshow ( 5 images )

Liberal Thomas Kemmerich became the first state premier elected with the support of the Alternative for Germany (AfD), with whom Chancellor Angela Merkel’s Christian Democrats (CDU) sided to the disgust of her national coalition partners.

The Feb. 5 result shattered the post-war consensus among established parties of shunning the far right, and led CDU leader Annegret Kramp-Karrenbauer to abandon her ambition of succeeding Merkel as Germany’s next chancellor.

Kemmerich, of the liberal Free Democrats (FDP), said a day after his election that his position was untenable and subsequently quit, paving the way for a new election.

Wednesday’s vote saw Bodo Ramelow of the far-left Linke, backed by the center-left Social Democrats (SPD) and ecologist Greens, reinstalled as premier after a third round of voting in secret ballots at the regional assembly.

Ramelow failed to secure a majority in the first two rounds when he faced a dual with the AfD’s candidate, far-right firebrand Bjoern Hoecke, who a court ruled last year could legally be called a fascist.

In the third round, Hoecke withdrew his candidacy and Ramelow ran alone, winning 42 of 85 votes cast - the same level of support he garnered in the first two rounds, suggesting his victory came without the support of the AfD or the CDU.

In the third round, the candidate with the most votes wins.

After Ramelow’s victory, Kemmerich presented him with a bouquet of flowers. Hoecke offered Ramelow his hand to shake but he did not take it, and the two had quite a lengthy exchange.

“When I can clearly hear that democracy is a priority, then I am willing to give Mr Hoecke my hand but only when you defend democracy and don’t trample on it,” Ramelow said in his acceptance speech, to applause from his supporters.