Frank-Walter Steinmeier, Germany's long-serving foreign minister who once called Donald Trump a "hate preacher," was elected as the country's 12th post-war president on Sunday by a special assembly in Berlin.
Steinmeier, 61, representing the center-left Social Democratic Party, won 931 votes among the 1,239 delegates to the federal assembly, known as the Bundesversammlung, made up of state and federal politicians and celebrities. He will serve a five-year term in the largely ceremonial post.
The election of the usually impeccably mannered diplomat, who spent seven of the last 11 years leading the foreign ministry, marked a setback for Chancellor Angela Merkel and her conservative Christian Democrats, who had failed to agree on their own candidate.
They reluctantly threw their weight behind Steinmeier after criticizing his uncharacteristically sharp comments about Trump, made during the U.S. presidential campaign last year.
Steinmeier, who faced four little-known challengers, is expected to be above politics and suspend his party membership as president.
Still, based on past presidential elections, his victory could give his party a boost going into September's parliamentary election, where Merkel is fighting an unexpectedly tight battle to win a fourth term against a popular new Social Democratic candidate, Martin Schulz.
The German presidential election in 2004 was a harbinger of political change in parliament when Merkel's Christian Democrats, then in opposition, narrowly defeated the candidate from the Social Democratic Party, which had control of the federal government at the time.
A year later, Merkel's Christian Democrats beat the Social Democrats to take back control of the government. Steinmeier later became the country's vice chancellor for two years before being crushed by Merkel when he ran for chancellor in 2009.
"We're living in stormy times, and people are worried," Steinmeier, a highly respected diplomat, said in an acceptance speech to the delegates Sunday. "The world seems to be coming apart at the seams."
His speech made repeated, tacit references to disconcerting changes in U.S. foreign policy expected under Trump.
"If the foundations start to wobble in other places, then we need to be even more determined than ever to support those foundations," he said.
The United States has long been a beacon of democracy and freedom for post-war Germany, a country where the scars of World War II are never far from the surface. As a result of the horrors of the Nazi regime, many Germans have especially sensitive antennae for the vulnerability of democracies in the face of authoritarian leaders, and there has been fear here that Trump could be in that mold.
"The history of our republic is the best argument there is against populism," said Steinmeier. "You'll find the best answers only in democracies."
Steinmeier, who resigned as foreign minister in Merkel's grand coalition government last month to run for the higher office, said he was proud that Germany has emerged as an important bastion for stability and role model for peace around the world in the decades since the end of World War II.
It also has become the temporary home for more than 1 million refugees from Syria and other turbulent regions in recent years.
"Isn't it a wonderful thing that Germany has become an anchor for hope for many people around the world?" said Steinmeier. "We're helping others find the courage — not because everything is perfect here in Germany. No, on the contrary, we've shown that things can get better, we've shown that peace is possible after war."
Russian President Vladimir Putin quickly congratulated Steinmeier and invited him to visit Moscow. Steinmeier last year was openly critically of NATO military maneuvers in eastern Europe, calling them "saber rattling." His party has long advocated a softer approach toward Russia than has Merkel's Christian Democrats.
In 2010, Steinmeier became something of a folk hero for donating one of his two kidneys to his ailing wife.
He takes office March 18. He will succeed Joachim Gauck, a former East German dissident and pastor who decided not to run for a second term.
Kirschbaum is a special correspondent.