Joachim Gauck was on Friday sworn in as German president, replacing Christian Wulff who was forced to step down over corruption allegations last month.
The 72-year-old civil-rights campaigner from the former East Germany took the oath of office before an assembly of both chambers of parliament in Berlin.
He was appointed to the largely ceremonial post a week ago with broad bipartisan support.
“Gauck is our first president who is not from the West and the first who does not come from a senior political position,” said Norbert Lammert, speaker of the Bundestag, or lower house of parliament.
Mr. Gauck, a retired Lutheran pastor and former custodian of the files abandoned by the East German communist secret police, promised in a speech to continue work by his predecessor to promote a “society open to immigrants” in Germany.
Mr. Wulff, who attended the swearing in, is being investigated on suspicion that he accepted illicit favours while serving as a state premier.
The scandal threatened to divert Chancellor Angela Merkel from the sovereign-debt crisis, but she joined with the opposition to back Mr. Gauck, a political independent, to quickly defuse the issue.
Mr. Gauck focussed his speech on what he called the “democratic miracle” in Germany after it had been a Nazi dictatorship.
He criticized Islamist extremists worldwide “operating under the cloak of religion,” saying, “We will unite against them. All nations are moving in the direction of freedom. They may be able to slow us down, but they can’t stop us.” Mr. Gauck, who has already begun his presidential work, is set for his first foreign trip on Monday - a visit to Poland to emphasize Germany’s close ties with its eastern neighbour after the enmity of World War II.
Mr. Gauck, who will serve a five-year term, emerged from retirement to take the job, which requires him to sign bills into law, pay State visits abroad and act as a moral authority.