Germans resoundingly elected Joachim Gauck, a former Lutheran pastor and human rights activist from communist East Germany, as president of Europe's most powerful country on Sunday, creating a potential political headache for Chancellor Angela Merkel.
In the largely ceremonial office of president, Mr. Gauck poses no threat to Ms. Merkel's domination of national politics, but his moral authority, independence of mind and lack of party affiliation could make him an awkward partner for her government as it struggles to overcome Europe's economic crisis.
Mr. Gauck, 72, won 991 votes in the federal assembly comprising members of parliament and regional delegates that elects German heads of state. His main rival, veteran anti-Nazi campaigner Beate Klarsfeld, got 126 votes.
Germans hope Mr. Gauck, a prominent player in the peaceful protests that led to the fall of the Berlin Wall in 1989, can restore dignity to the presidency, a post tarnished by financial scandals that toppled his predecessor Christian Wulff.
"I take up this post with the endless gratitude of a person who, after a long trek through the political desert of the 20th century, has finally and unexpectedly found his home again and was able to witness in the last 20 years the joy of shaping a democratic society," he said after taking the oath of office.
His victory was never in doubt after all the main political parties, including Ms. Merkel's centre-right Christian Democrats, threw their weight behind his candidacy.
Ms. Merkel played down suggestions that the feisty theologian would use his office as a pulpit to harangue Germany's politicians or that they might clash over policy issues.
"He may well disapprove of something, so might I, but we are all adults... I think there will be good collaboration," she told reporters after giving Mr. Gauck a large bouquet of flowers.
Mr. Gauck struck a similar tone in an interview for ARD channel.
"I have offered her (Ms. Merkel) my trust, my sincerity and loyalty. We have looked each other in the eye and I see no grounds for mistrust," Mr. Gauck said.
Ms .Merkel can ill afford disputes with the president as she tries to build cross-party support for tighter fiscal rules to tackle the euro zone's two-year sovereign debt crisis that has forced Germany to assume greater leadership in Europe.
Ms. Merkel only reluctantly endorsed Mr. Gauck's candidacy after her coalition ally, the Free Democrats, joined opposition parties last month in backing him to replace the disgraced Mr. Wulff.
Unlike career politician Wulff, Mr. Gauck – who describes himself politically as "a left-leaning, liberal conservative" – likes to speak his mind on controversial issues, and he does so with an eloquence forged in the pulpits of East Germany.
"The new president will polarize the republic with his views about freedom," the weekly news magazine Der Spiegel said in an article stressing his deep attachment to individual liberty.
"Unlike his predecessor, Gauck does not intend to kowtow to political conventions. He will thereby inevitably become an antagonist of the chancellor."
Eighty per cent of Germans trust Mr. Gauck, according to an opinion poll by Infratest, yet two-thirds said they thought he would be an "uncomfortable" president for the political parties.
"The president of the federal republic must be the guardian of the soul of our nation," said Sunday's edition of the top-selling daily Bild which also backed Mr. Gauck for the job in 2010.
"Gauck's most important task is to restore dignity to this considerably tarnished office."
French President Nicolas Sarkozy, a key euro zone ally of Ms. Merkel, praised Mr. Gauck's commitment to freedom and democracy in a letter of congratulation to the new German head of state.
Mr. Gauck said he hoped to pay his first visit as president to Poland, another important neighbour with which Ms. Merkel has forged close political and economic ties within the EU.
Ms. Merkel and Mr. Gauck both hail from old East Germany where her father was also a clergyman. They are said to have a good personal rapport, but she blocked a bid to install him as president in 2010 in favour of the ill-fated Mr. Wulff.
Mr. Gauck has a rich life story shaped by the Cold War. When he was 11, his father was sent to the Siberian Gulag for alleged espionage and did not return for four years.
That experience fostered an abiding aversion to totalitarianism, and he has said freedom will be the leitmotif of his presidency.
After the fall of Communism and Germany's reunification, Mr. Gauck oversaw the archives of the dreaded Stasi, the East German secret police, earning recognition for exposing their crimes.
He ensured that the files were used to root out former Stasi employees and collaborators in public service and to understand the country's past.
More recently, he has had to defend his decision to keep former Stasi employees working at the archives, workers whose insider knowledge made them, he thought, "indispensable".
Mr. Gauck has four children with his now-estranged wife. Some conservative German politicians have said that, as president, he should marry his longtime partner, a journalist 20 years his junior, to set a good moral example.
The speaker of the Bundestag, the lower house of parliament, Norbert Lammert, said on Sunday he hoped Mr. Gauck would serve out his full five-year term, restoring stability to an institution shaken not only by Mr. Wulff's premature resignation but also by the sudden departure of Mr. Wulff's predecessor, Horst Koehler.
Mr. Koehler resigned in 2010, early into his second five-year term as president, after making comments about Germany's involvement in Afghanistan deemed inappropriate.