BERLIN - A far-reaching majority of lawmakers elected former East German pro-democracy activist Joachim Gauck as Germany's new president Sunday.

The 72-year-old Gauck is an outspoken former Lutheran pastor and relentless advocate of democracy and civil rights who enjoyed the backing of most major parties. He received 991 of the 1,232 ballots cast.

The ex-communist Left party's candidate Beate Klarsfeld secured 126 votes, the far right NPD party's candidate Olaf Rose only three, and there were 108 abstentions, said Norbert Lammert, the President of the Germany's Parliament.

Gauck opposed East Germany's then-communist regime and became head of a federal agency overseeing the files of the Communists' ubiquitous domestic intelligence service after Germany's reunification in 1990.

The candidate appeared moved as he accepted the election to become the country's new head of state, a largely ceremonial role in Germany that has little executive power but is considered an important moral authority.

"I accept this duty. After the long political meanders of the 20th century, I do so with the infinite gratefulness of a person who has finally and unexpectedly found his home again and who had the pleasure of participating in a democratic society over the past 20 years," Gauck told the assembly.

"Very certainly I won't be able to live up to all expectations," he said. "But there is one thing I can promise: I say yes with all of my force and with my heart that I will carry out the responsibility you entrusted to me today."

Gauck, who has no political affiliation, won wide backing from Germany's mainstream parties for the presidency after predecessor Christian Wulff resigned in a corruption scandal last month.

When he was nominated, Chancellor Angela Merkel described Gauck as "a true teacher of democracy." Gauck had run for the opposition against her candidate, Wulff, two years earlier, but Merkel's junior coalition partner pushed her to accept him as president at the second attempt.

On Sunday, Merkel said Germany can be proud of its new president, who was elected with a "very convincing result."

The chancellor, herself daughter of a pastor and another former East German, also said that Gauck's election was a sign of the success of Germany's reunification.

"We can also be a little proud of that," Merkel said, adding that more progress was still required to see eastern Germany catch up fully with the wealthier western part.

In 1989, Gauck, then a pastor based in the northern port city of Rostock, helped initiate protests against the communist regime in his region.

He joined a prominent opposition group in the final phase of hardline communist rule, and after communism fell he was elected in March 1990 to serve as a lawmaker in East Germany's first and only democratically elected Parliament until reunification that October.

Sunday's election came exactly 22 years after that ballot "when millions of East Germans were finally allowed to be citizens after a 56 years long reign of dictators," Gauck said in his acceptance speech.

"At age 50 I had for the first time in my life the chance to vote in a free, equal and secret ballot on who would govern (the country) in the future," he said.

Gauck was one of the leaders of efforts to wind up the Stasi, East Germany's loathed and notoriously invasive secret police.

In January 1990, demonstrators had stormed the Stasi headquarters in East Berlin to prevent the files' destruction. For the next decade, Gauck oversaw the newly created government authority that oversees the 180 kilometres of files collected by the Stasi's network of 85,000 full-time spies and 170,000 voluntary informers.

German Foreign Minister Guido Westerwelle said Gauck's life story of standing up for freedom and civil rights "is also an encouragement for many freedom movements around the world."