Frank-Walter Steinmeier, right, and German chancellor Angela Merkel attend a mass at St Hedwigs cathedral in Berlin, Sunday, Feb. 12, 2017. (Kay Nietfeld/DPA via AP)

Frank-Walter Steinmeier, the former German foreign minister who was a vocal critic of Donald Trump during the U.S. campaign, was elected Sunday as the country’s 12th postwar president.

The Social Democrat, who served two stints as foreign minister under Chancellor Angela Merkel, emerged as her governing coalition’s candidate in November as their parties sought to avoid a political spat over the appointment in an election year. With the support of Merkel’s Christian Democratic-led bloc and the Social Democrats in a special assembly on Sunday, Steinmeier was elected in the first round to the mostly ceremonial post.

While Merkel steered clear of sharing her views on Trump before his election as president, her top diplomat vociferously derided what he saw as a campaign that broke taboos and threatened trans-Atlantic bonds. At one point, Steinmeier called Trump a “hate preacher.” As head of state, Steinmeier will be Trump’s counterpart, according to protocol, even though the German presidency lacks the political or policymaking power held by the chancellor.

The day after Trump’s surprise election victory, Merkel issued a couched warning that offered the new U.S. president German cooperation based on joint values, including democracy, respect for the rule of law and for human dignity “independent of origin, skin color, religion, gender, sexual orientation or political views.” Steinmeier was less diplomatic.

“The result is not what most Germans would have wished,” Steinmeier said Nov. 9. “I don’t want to sugarcoat anything. Nothing will be easier, many things will become more difficult.”

Steinmeier shunned political tension or any mention of Trump in an eight-minute speech after his election, though he cited Germany as an “anchor of hope” in an increasingly unsettled world.

“We’re living in tumultuous times; many in our country feel insecure,” he told the assembly after winning 931 of 1,253 votes cast.

Steinmeier, 61, will succeed Joachim Gauck, 77, who opted to stand down after serving a single five-year term. Gauck will remain in office until March 18.

Steinmeier, who had a 79 percent approval rating this month in a poll for public broadcaster ARD, came forward as a presidential hopeful after Merkel failed to find a suitable candidate from within her party bloc willing to run.

The Social Democrats have enjoyed a surge in support after the surprise candidacy for chancellor of Martin Schulz, the former European Parliament president. Enthusiasm for Schulz in the SPD base has narrowed the gap with Merkel seven months before the vote, with one poll last week showing the party ahead.