Conservative supporters of Brexit including Boris Johnson and Michael Gove have written to David Cameron urging him to stay on as Prime Minister regardless of the result, as counting got under way in the historic referendum on UK membership of the European Union.

The letter was delivered to 10 Downing Street as leading Leave supporter Nigel Farage indicated he was preparing to concede defeat.

The Ukip leader said the Remain camp seemed likely to "edge it", but insisted his party would continue its fight to take Britain out of the EU.

The final polls of the campaign put the In side ahead by a narrow margin, with a YouGov survey released as polling stations closed at 10pm giving Remain 52% to Leave's 48%.

With no exit polls conducted by broadcasters, a reliable picture of the likely outcome was not expected to emerge until the early hours of Friday, with the final result expected at breakfast time.

Some 84 Tories signed the letter to tell Mr Cameron: "We believe whatever the British people decide you have both a mandate and a duty to continue leading the nation implementing our policies."

As well as Mr Johnson and Mr Gove, the signatories included Cabinet-level Brexit backers Chris Grayling and John Whittingdale, but not Iain Duncan Smith, who quit as work and pensions secretary shortly before the referendum

Tory MP Robert Syms said that two-thirds of Conservative MPs who broke with the PM to back Leave had signed the letter, but said it had not been possible to reach all of them to ask them to sign.

Mr Farage told Sky News: "It's been an extraordinary referendum campaign, turnout looks to be exceptionally high and (it) looks like Remain will edge it.

"Ukip and I are going nowhere and the party will only continue to grow stronger in the future."

But Mr Duncan Smith cast doubt on Mr Farage's suggestion that Remain is set for victory.

"I never quite follow what Nigel Farage says," he told the BBC. "Quite often he says two different things at the same time.

"I genuinely do not have a sense of how this has gone."

Mr Grayling said it would be an "absolute nonsense" for Mr Cameron to lose his job given that he won an election just over a year ago promising to hold a referendum.

"It would be an absolute nonsense if David Cameron felt, having given the country that choice, if they take the decision he couldn't carry on the job," he told Sky News.

"We are completely behind him staying, we want him to stay and that letter is a statement of commitment to his leadership."

But Labour's Jonathan Ashworth said that the letter could not "unsay" the comments of Tory MPs who have spent the last few weeks attacking the PM.

"This letter exposes the reality that David Cameron and the Conservative Party are now utterly preoccupied with leadership infighting rather than the future of the country," said Mr Ashworth.

"What's more this letter cannot unsay what senior Tory politicians have been telling us for weeks - that the British people simply cannot trust David Cameron.

"The truth is this is a desperately weak and divided Government unable to provide the leadership the country needs."

Sterling rose 1% against the US dollar in overnight markets amid speculation that Remain has won the referendum.

But Mr Grayling refused to follow Mr Farage in predicting the result.

And Leave.EU said that it had conducted an "internal poll" of 10,000 people which suggested that Brexit was leading by 52% to 48%.

"I think we're only going to know the full picture as the night goes on and frankly anyone right now who's certain what the result is going to be only has to think back to last year," said Mr Grayling."I think perhaps I'll wait and see what actually happens when the votes are counted."

Labour In chair Alan Johnson added: "It's the first time I've agreed with Chris in six weeks - he's absolutely right, let's wait for a post-match analysis until it's post-match."

Education Secretary Nicky Morgan said she was "confident and hopeful that there will be a victory for the Remain campaign".

Many polling stations in south east England reported high turnouts despite atrocious weather, so declarations could be later than previously expected.

Results predicted for between 2am and 3am could be put back an hour or two, it was being suggested, in some parts of the region.

There were also concerns that some commuters stranded in London because of chaos on the railways might not have got home in time to vote.

Boris Johnson had a last-minute dash to vote in north London, due to a delay to his flight from Scotland after attending his daughter's university graduation ceremony - finally reaching the polling station with less than 25 minutes to spare.

Waiting for his plane in Edinburgh, he told reporters that polls had been "very close" but turnout was "good in areas where we need it to be"

In Gibraltar, which is taking part in the referendum as a British overseas territory within the EU, turnout was a healthy 84%.

A record number of voters are eligible to take part in the referendum, with the Electoral Commission putting the number at 46,499,537.