A huge political upset in Germany's eastern state of Thuringia on Wednesday sparked a widespread outcry across the country as the ruling coalition saw its candidate for state premier lose by a single vote to the pro-business Free Democrats (FDP), who had barely cleared the 5% support hurdle to join the regional parliament.

What was even more cause for concern, however, was the historic role of the far-right Alternative for Germany (AfD) party in the victory of FDP candidate Thomas Kemmerich (above), marking the first time a German state premier was able to take office with the help of the nationalist party.

Read more: Opinion: A disgrace for Germany

Thuringia held its state election all the way back in October, with the ruling Left party winning the highest share of the votes at 31%. At the same time, however, the AfD more than doubled its own support to come in second at 23.4% of the vote.

The AfD is an ethno-nationalist party that is opposed to non-European immigration, which it perceives as the "Islamization" of Germany, and is opposed to reforms that tackle climate change.

Protesters began gathering outside the parliament building only two hours after the vote in the state capital of Erfurt:

A spontaneous demonstration also sprang up in Berlin on Wednesday evening, with witnesses saying thousands of people had appeared outside FDP headquarters to express their anger.

A single vote

The ruling Left party has spent months trying to form a coalition with the center-left Social Democrats (SPD) and the Green party. After a lot of protracted wrangling, the three parties had finally signed an agreement to rule together on Tuesday evening.

It was expected that lawmakers in Thuringia's parliament would elect the Left party incumbent, Bodo Ramelow, without much fanfare. However, in the third round of voting the AfD decided not to support the independent candidate it had previously supported and throw all of its weight behind Kemmerich.

Together with the votes of his own party and the center-right Christian Democrats (CDU), the party of Chancellor Angela Merkel, Kemmerich came away with 45 votes to Ramelow's 44.

The outrage on social media over the AfD's role as kingmakers was swift and resounding. Ordinary Germans, public figures, and politicians all expressed their consternation, saying the FDP and CDU had gotten into bed with "fascists."

On their official Twitter page, the Left party accused the FDP of believing that it was "better to rule with fascists than not to rule at all."

Left party head Bernd Riexinger told DW it was a "black day" for German politics and reminiscent of the way that mainstream parties had conceded ground to the Nazis in the 1920s.

"It appears that neither the FDP nor the CDU have learned anything from history," Riexinger said. "Before the election, every party stressed they would not seek AfD support. That promise is obviously not worth the paper it was written on."

Marie-Agnes Strack-Zimmermann, an outspoken member of the FDP in Germany's federal parliament, said that while she liked Kemmerich personally, it was "unacceptable" to allow oneself to be elected by someone like Björn Höcke, the spokesman for the AfD in Thuringen.

Höcke congratulated Kemmerich on his win. Kemmerich was criticized for accepting the handshake

"This is a hard day for me" as a member of the FDP, she wrote.

Höcke is one of the most controversial figures in the AfD's leadership structure, having criticized the Memorial to the Murdered Jews of Europe in Berlin and advocated the abolition of a law that makes Holocaust denial illegal in Germany, amongst numerous other scandals.

It is unclear what will happen next as Thuringia tries to form a government, but Kemmerich has said he will refuse to form a ruling coalition with the AfD.

A sharp rebuke from Merkel's party

By the end of the day on Wednesday, various politicians had floated the idea of new elections in Thuringia.

Most prominent among them was CDU chief Annegret Kramp-Karrenbauer, who asserted that the FDP's Kemmerich had "no stable basis" to govern and said her party's leadership had decided to call for fresh state elections.

In a rebuke of her party's state-level officials, Kramp-Karrenbauer accused Thuringian CDU members of having "explicitly acted against the recommendations, demands and requests of the party" in aligning with the AfD.