An anti-gay German mayor has lost his seat to openly gay candidate Sven Gerich, of the Social Democratic Party (SPD).

In a nail-biting election deciding the mayor of Wiesbaden in Hesse, Gerich won with 50.8% of the vote over the incumbent Helmut Müller’s 49.2%.

Müller, of Angela Merkel’s Christian Democratic Union (CDU) party who opposes same-sex marriage, has been mayor of Wiesbaden since 2007. Just two weeks before, preliminary results showed Müller had been leading with the vote.

‘I thank all voters for their confidence,’ the 38-year-old Gerich said. ‘Although I am still overwhelmed, it is slowly starting to sink in.’

‘This overwhelming success is the result of a great campaign. My further thanks go to all the people who helped and supported me.’

On the election night, the 60-year-old Müller told DAPD he was ‘expecting a close vote’. He also said the result must be analyzed at once and ‘digested’.

Some German political experts are saying this win is symbolic of the public becoming tired with the CDU.

Merkel’s party has run the state since 1999 and hoped to have extended that run until 22 September, the day Germany elects a new parliament.

The SPD, who are in favor of marriage equality, has extended its run of wins since winning the Frankfurt mayoral election last year.

Gerich joined the party recently, in 2003, and from 2008 to 2011 he was parliamentary secretary of the SPD faction city council.

A center-left politician and entrepreneur, he promised to promote business growth in the traditionally conservative south-west city.

In 2001, Klaus Wowereit became one of the most famous gay politicians in Germany when he was elected mayor of Berlin.

Prior to being elected, he coined the now famous German phrase ‘Ich bin schwul, und das ist auch gut so.’ (I’m gay, and that is absolutely fine.’)