Chancellor Angela Merkel's candidate for the German presidency, Christian Wulff, was elected in a third and final round of voting in Berlin today.
Mr Wulff, the prime minister of Lower Saxony and a deputy leader of Ms Merkel's Christian Democratic Union party, got 625 votes to 494 votes for Joachim Gauck, a pro-democracy activist and pastor from former East Germany who was nominated by the opposition Social Democrats and Greens. There were 121 abstentions of the 1,240 valid votes cast.
In a day of drama that has damaged her authority, approximately 30 rebels in Ms Merkel's ruling coalition forced Mr Wulff to stand for election a third time by failing to back him twice in the secret ballot.
But for Ms Merkel to be denied a win, the centre-left were reliant on near total support from the far-left Left Party during the third round of voting this evening.
Earlier tonight, however, the far-left opposition said it would not back Mr Gauck, the centre-left's nominee in the third round of voting. The Left Party objected to Mr Gauck because of his criticism of the former East Germany, where he was a prominent civil rights activist.
Mr Wulff received 600 votes in the first round and 615 in the second, falling short of the 623 he needed. Mr Gauck scored 499 votes in the first ballot and 490 in the second.
Ms Merkel desperately needed a clear victory in the federal assembly that elects the head of state to boost her authority after a series of poor showings in opinion polls and setbacks including the resignation of Horst Koehler as president in May.
Her coalition's candidate, Mr Wulff, went into the contest with an absolute majority on paper, but popular civil rights activist Mr Gauck had strong cross-party appeal.
The ruling coalition has 644 seats in the special assembly, well over the 623 needed for an absolute majority, but only 600 voted on the first ballot for Mr Wulff, meaning that some on the government benches voted for the opposition candidate.
Agencies