UKIP candidate Roger Helmer has lost the Newark by-election.

Mr Helmer, who was recently re-elected as a Member of the European Parliament, fought a campaign in Newark against the backdrop of sustained criticism about his views on homosexuality.

Mr Helmer won 10,028 votes compared to the victorious Conservative candidate Robert Jenrick’s 17,431 votes. Labour and the Liberal Democrats were significantly down, the Lib Dems pushed into sixth place. Tories targeted Labour and Liberal Democrat voters asking them to ‘lend’ their vote to the Conservatives in order to prevent UKIP from winning. A leaflet highlighted homophobic and racist outbursts by UKIP candidates and officials.

UKIP leader Nigel Farage said earlier today: “I think this has been a stunning campaign that we’ve fought in a very short space of time.

“We’ve been up against probably the biggest ever Conservative machine, defending about their 40th safest seat in the country. If the indications are right, we’ll be celebrating a massive advance for our party.”

The 70-year-old Mr Helmer generated his first media storm last month, over his previous comments that the public should be able to dislike gay people in the same way as different types of tea.

He found himself at war with The Sun after the paper accused him of being a “bigot”.

Despite cross-party criticism, UKIP leader Nigel Farage repeatedly leapt to Mr Helmer’s defence.

Shortly before the polls opened in the European elections, Mr Farage said on Newsnight: “Can you name me a party that hasn’t got people … particularly over the age of 70 who were brought up at a time when they were taught at school this was wrong?”

Mr Helmer had sought to play down the comments, telling reporters his quoted remarks about “homosexual behaviour” being seen as “abnormal and undesirable” were made 12 years ago when he was a Conservative MEP.

Although both he and UKIP oppose equal marriage, Mr Helmer claimed he would be happy to attend a same-sex wedding.

However, he remained in the spotlight following the resurfacing of his controversial views about gay-to-straight conversion therapy.

On Monday, Mr Helmer launched a broadside at The Mail on Sunday, accusing the paper of publishing “deliberate and defamatory lies”.

He was quoted by The Mail of having suggested the NHS should offer “cures” for people who are gay.

The politician wrote the next day on his blog: “Let’s be clear: I have never said that homosexuality is ‘an illness’, or that it can be ‘cured’.

The East Midlands MEP previously tweeted in 2011: “Why is it OK for a surgeon to perform a sex change operation, but not OK for a psychiatrist to ‘turn’ a consenting homosexual?

The final count was:-

Robert Jenrick (Con) 17,431 (45.03%, -8.82%)

Roger Helmer (UKIP) 10,028 (25.91%, +22.09%)

Michael Payne (Lab) 6,842 (17.68%, -4.65%)

Paul Baggaley (Ind) 1,891 (4.89%)

David Kirwan (Green) 1,057 (2.73%)

David Watts (LD) 1,004 (2.59%, -17.41%)

Nick The Flying Brick (Loony) 168 (0.43%)

Andy Hayes (Ind) 117 (0.30%)

David Bishop (BP Elvis) 87 (0.22%)

Dick Rodgers (Stop Banks) 64 (0.17%)

Lee Woods (Pat Soc) 18 (0.05%)