Image copyright PA

Votes are being counted in the Rochester and Strood by-election where the UK Independence Party is hoping to gain its second elected Westminster MP.

Turnout was just over 50% in the contest, triggered by MP Mark Reckless's defection from the Conservatives to UKIP.

Polls suggest he is on course to win the seat for the party, which campaigns for the UK to leave the European Union.

The Conservatives hope to keep the seat and break UKIP's momentum.

BBC political editor Nick Robinson said: "No-one in the Tory side is predicting that they are going to win, everyone on the UKIP side are predicting that they will."

UKIP were "downgrading expectations" by suggesting the outcome could be close, he said, adding: "There's no doubt what the final outcome will be, it's just a question of how many votes are in it."

Earlier, shadow attorney general Emily Thornberry resigned from the Labour front bench after being accused of "sneering at the electorate" by tweeting a photograph of a Rochester house displaying England flags and with a white van parked outside.

Defection rumours

Former Conservative Douglas Carswell, a close friend of Mr Reckless, won the Clacton by-election last month, having also defected to UKIP.

Image copyright Reuters

Image caption Mark Reckless says he is taking nothing for granted

Image copyright Reuters Image caption Kelly Tolhurst was chosen as Conservative candidate via an open postal primary

Image copyright Getty Images Image caption UKIP leader Nigel Farage is hoping his party will get a second MP in Westminster

Image copyright Getty Images Image caption Labour candidate Naushabah Khan was joined by Labour frontbenchers on the campaign trail

Arriving at the count in Gillingham, Mr Reckless said he was not taking anything for granted.

When he arrived, Mr Farage said he was "hoping" for a UKIP win, predicting this would be "pretty bad news" for Prime Minister David Cameron.

There have been rumours that other Conservative backbenchers are considering leaving the party for UKIP, six months before the general election.

But Conservative MP Stewart Jackson said: "Any Tory MP who defects to UKIP on the basis of the result in Rochester and Strood - whatever it is - would frankly be completely insane."

Mr Reckless announced his defection on the eve of the Conservative Party conference in September - Labour described it as a "hammer blow" for David Cameron's authority over his own party, particularly those on the right.

Mr Cameron says the contest is a "two horse race" between his party and UKIP - and has visited the constituency five times to support the Conservatives' candidate Kelly Tolhurst, a local councillor selected for the party in an open postal primary.

Naushabah Khan for Labour, Geoff Juby for the Lib Dems and Clive Gregory of the Green Party were among 13 candidates standing for the seat.

How unusual is Rochester and Strood?

By Ed Lowther, BBC News data journalist

Image copyright Getty Images

As UKIP marched towards by-election victory in Clacton, analysts sought to explain its appeal with reference to the seat's unusual demographics. Does the same reasoning work in Rochester and Strood?

Clacton had the second highest proportion of over-65-year-olds in England and Wales.

Rochester and Strood, by contrast, has a much younger population, with fewer over-65s than the national average.

Both seats have higher unemployment rates than the national average.

But in Rochester and Strood's case the difference is marginal.

How unusual is Rochester and Strood?

Analysis: What's at stake for the parties?

Labour came second in the constituency in 2010. Leader Ed Miliband will want to reassure his party that it is not also in danger of losing seats to UKIP, which came a close second in another by-election in Heywood and Middleton in October.

Mr Reckless won the Kent seat for the Conservatives in 2010 with 49.2% of the vote. Labour came second with 28.5%, followed by the Lib Dems, the English Democrats and Green Party. The result is due early on Friday.

Full details of the results as they come in - and the reaction - will be on the BBC News website and the BBC News Channel through the night.

There is a by-election special on BBC One with Andrew Neil.

In Rochester and Strood the candidates, in alphabetical order, are:

Barker, Mike - Independent

Challis, Christopher - Independent

Davidson, Hairy Knorm - Official Monster Raving Loony Party

Fransen, Jayda - Britain First

Goldsbrough, Stephen William - Independent

Gregory, Clive - Green Party

Juby, Geoff - Liberal Democrats

Khan, Naushabah - Labour

Long, Nick - People Before Profit

Osborn, Dave - Patriotic Socialist Party

Reckless, Mark - UK Independence Party

Rose, Charlotte - Independent

Tolhurst, Kelly - Conservative