German President Frank-Walter Steinmeier was re-elected for a second term of five years by a special parliamentary assembly on Sunday.
Steinmeier had been endorsed by most mainstream political parties ahead of the election for the largely ceremonial head of state.
The president was elected with a big majority by a special assembly made up of the members of parliament's lower house and representatives of Germany's 16 states.
"My responsibility is for all the people who live in our country. Non-partisan, yes - but I am not neutral when it comes to the cause of democracy. Whoever fights for democracy will have me on his side. Whoever attacks it will have me as an opponent," Steinmeier said in a speech to the special assembly after accepting his election.
Before first becoming president in 2017, Steinmeier, 66, served two stints as Chancellor Angela Merkel's foreign minister and earlier was chief of staff to Chancellor Gerhard Schroeder.
Germany's president has little executive power but is considered an important moral authority. After a messy parliamentary election result in 2017, Steinmeier helped prod politicians to form a new coalition government rather than holding out for a new vote.