UKIP candidate John Sullivan who claimed regular physical exercise in schools can “prevent homosexuality” has failed to be elected as a councillor for Newent in Gloucestershire.
Mr Sullivan’s comments, which have since been deleted, were made on a Facebook group called “Traditional Britain Group.”
He also applauded Russia for banning gay pride marches in Moscow, saying: “Well done the Russians.”
Mr Sullivan came second in Thursday’s contest.
He was 391 votes behind the Conservative winner Will Windsor-Clive, who was elected on 988 votes.
Earlier in the week, the UK Independence Party’s affiliated LGBT group condemned Mr Sullivan for the remarks and also the alleged anti-LGBT behaviour of Staffordshire Stone Rural UKIP candidate David Nixon.
The leaflet, which was sent to PinkNews by a reader, mocked bisexuals and blasted the government’s same-sex marriage bill, warning it would lead to explicit “Homosexual Sex Education”.
Meanwhile, UKIP leader Nigel Farage has hailed early results showing gains in council elections across England as “remarkable” for the party.
UKIP has won 42 seats so far and is averaging 26% of the vote in the wards where it is standing.
Mr Farage said it put his party in a “very strong position” in the run up to the next general election.
Unlike the Conservatives, Labour and Liberal Democrats, UKIP is officially opposed to marriage rights for gay couples and only supports civil partnerships.
Elsewhere Labour’s Emma Lewell-Buck has won the South Shields parliamentary by-election, with UKIP’s Richard Elvin coming second.
The result was disastrous for the Liberal Democrats, who were pushed down to seventh place and lost their deposit, and also bad for the Conservatives, picking up just 11.5% of the vote.