German lawmakers elected Frank-Walter Steinmeier by an overwhelming majority Sunday to be the country's new president.
Steinmeier, Germany's former foreign minister, was elected in Berlin by a special assembly that was made up of the 630 members of parliament's lower house and an equal number of representatives from Germany's 16 states.
He received 931 of the 1,260 votes. Steinmeier succeeds Joachim Gauck, a 77-year-old former pastor and East German pro-democracy activist who did not seek a second five-year term because of his age.
The German president has little executive power, but is considered an important moral authority and symbol of the country as its host for visiting dignitaries.
"Let's be brave, because then we don't have to be afraid of the future," Steinmeier said in his acceptance speech.
He said the world faces "rough times," but that Germany, as a functioning democracy, had the responsibility to fight for stability.
"Isn't it actually wonderful, that this Germany, our difficult fatherland, that this country has become an anchor of hope in the world for many," after overcoming wars and totalitarianism, Steinmeier said.
German Chancellor Angela Merkel congratulated Steinmeier and said she was convinced he would be an excellent president who would have the support of the vast majority of the people. "This is a good day for Germany," Merkel said.
Steinmeier, a 61-year-old Social Democrat, had the backing in the election of Merkel's "grand coalition" of center-right and center-left parties.
The presidential vote was likely one of the last moments of coalition unity ahead of a parliamentary election in September in which Merkel is seeking a fourth term. Both sides hope to end the "grand coalition."
A few years ago, Steinmeier took a several-months absence from politics, to donate one of his kidneys to his wife Elke Buedenbende. Buedenbende, who is a judge, will not work during her time as first lady to avoid possible conflicts of interest.
Steinmeier has long been one of Germany's most popular politicians. As former Chancellor Gerhard Schroeder's chief of staff, he was a main architect of Schroeder's 2003 package of economic reforms and welfare cuts.
Under Merkel, he served twice as foreign minister — from 2005 to 2009 and again from 2013 until this year, with a stint as opposition leader in between.
Steinmeier is normally studiously diplomatic, but he strongly criticized Donald Trump during the US election campaign.
Asked in August about the rise of right-wing populism in Germany and elsewhere, Steinmeier criticized those who "make politics with fear."
He cited the nationalist Alternative for Germany party, the promoters of Britain's exit from the European Union, and "the hate preachers, like Donald Trump at the moment in the United States."
Report by Kirsten Grieshaber; Geir Moulson contributed reporting; Associated Press.