The candidate who led the far-right Alternative für Deutschland party to a historic state election victory in Germany has thanked Elon Musk for his support, as one French minister warned that this was a “serious moment” for Europe.

The AfD more than doubled its support in the Saxony-Anhalt region and appears to be on the brink of becoming the first far-right party to gain power in Germany at state level since the second world war.

On Sunday night, Ulrich Siegmund, the AfD’s lead candidate, thanked Musk on X “for your support and for your clear and highly important perspective on the political developments of our time”, adding: “I would very much welcome the opportunity for strong and constructive cooperation”.

Siegmund wrote his comments after Musk said “Well done!” in German to AfD co-founder Alice Weidel, when she posted about the projected win.

Earlier, US president Donald Trump posted a screenshot of the election projection without comment on his Truth Social site. Russian presidential envoy Kirill Dmitriev took a screengrab of Trump’s post and praised a “historic win for the pragmatic AfD”. AfD is pro-Kremlin, urging a stop to support for Ukraine and pushing for Ukrainians to no longer receive refugee status.

Despite its resounding victory, AfD fell just short of winning a majority. The party was seeking an absolute majority in the state legislature to govern alone and overcome the so-called firewall of mainstream parties’ refusal to work with AfD.

Final results showed AfD falling three seats short, with 39 lawmakers in an 83-member parliament.

However, it still remains unclear as to how and whether the AfD will be able to form a government, having ruled out entering a coalition and being refused any form of cooperation by the mainstream parties.

AfD won 43.8% of the vote, more than double its showing five years ago in the region of 2.1 million people west of Berlin. That was far ahead of Friedrich Merz’s Christian Democratic Union, which polled 17.2% – losing about half its support – and won 15 seats. The centre-left Social Democrats polled 9.3%, the Greens 8.9% and the Left party 8.6%, winning eight seats apiece.

The BSW party, which has said it wouldn’t elect either Siegmund or incumbent Sven Schulze as governor but criticises the “firewall” against AfD, took 5.3% and fives seats.

France’s Europe minister, Benjamin Haddad, described the win as “a serious moment in Europe”, warning that “nationalism and xenophobia will never be a solution”.

“We must listen with humility to the anger, the concerns, the fears, and respond to them,” he added. “We cannot forget our history. That is the meaning behind the choices made by France and Germany.”

Donald Tusk, the prime minister of Poland, said: “In Poland, only idiots or traitors can rejoice at the triumph of the AfD in Germany.”

The German Economic Institute has warned of the far-reaching consequences for the German economy, in Saxony-Anhalt and beyond. It said the AfD’s immigration policy would be “calamitous” for the state, which has an ageing, dwindling population and is heavily dependent on foreign workers.

Critics have also warned that an AfD-run state, due to the Kremlin-friendly stance of the party, could leak sensitive information to Russia. The AfD has dismissed such claims. It has said it would seek to reform the domestic intelligence service, calling it biased.