German lawmakers have elected Joachim Gauck to be the country's 11th president since the end of World War II.
A former Lutheran pastor and human rights activist, the 72-year-old Gauck won 991 votes out of 1,232 at a special assembly of MPs.
Gauck, from the former communist east, is known for speaking his mind on controversial topics.
Analysts say that may make him an awkward partner for Chancellor Angela Merkel.
Gauck is replacing Christian Wulff, who resigned in a scandal over financial favors.
The position of president in Germany is a mainly ceremonial post.
With AP, dpa, and Reuters reporting