Sweden’s far-right anti-immigration party would have been celebrated its first mayor in the country. Instead party officials were dealing with a social media controversy in which Stefan Borg, the Sweden Democrats politician who won the most votes in (Skåne town) Hörby municipality, announced he would stepping down.

His decision to resign from the post came after Swedish media uncovered controversial social media posts.

“The media attention that has been directed at my person has made in impossible for the party in (Skåne town) Hörby to instead focus on what’s important: Hörby’s future and the policies we want to pursue for the municipality,” Borg said in a statement on October 22.

As reported by The Local, the anti-racism magazine Expo investigated Borg’s activity on social media, and found he had shared extremist far-right and anti-Semitic content, as well as making homophobic statements including comparing LGBT people to necrophiliacs and paedophiles.

Replacing Borg, the party’s deputy group leader in Hörby, Cecilia Bladh in Zito, will be put forward for the role of mayor.

The move is a blow for the SD, which became the largest party in the town of Hörby after elections on September 9, with a total of 35.4% of the vote.