Britain's EU vote goes down to wire
UK is bitterly divided on EU membership as Remain side pins hopes on London surge
The pound fell sharply on financial markets overnight as early results in the EU referendum suggested the Leave campaign was performing above expectations.
Despite pessimistic forecasts from Ukip leader Nigel Farage, who said he thought Remain had "nicked it", Brexit pushed into a slender early lead on the back of wins in Sunderland, Swindon, Middlesbrough, Hartlepool and Kettering.
Pro-Leave Tories including Boris Johnson and Michael Gove signed a letter to David Cameron, urging him to stay on as leader whatever the result of the referendum.
Senior Labour figures including Ed Miliband and Yvette Cooper suggested that the scale of support for Leave was fuelled by discontent with the way the country was heading on issues like wages, jobs and opportunities for the young.
"It's a nation divided and the PM will have a big responsibility - particularly if it's a Remain win - to show he understands what people are saying on the Leave side of the argument," said former Labour leader Mr Miliband.
Labour's shadow chancellor John McDonnell said that whatever the result, Mr Cameron would be a "hostage" to his pro-Brexit MPs, who will make sure they seize "key positions".
As polling stations closed at 10pm on Thursday, Ukip leader Nigel Farage said he thought Britain had voted to remain in the EU, but that his party would not give up the fight to take control back from Brussels.
"Win or lose this battle, we will win this war," he said. "The Eurosceptic genie is out of the bottle and it will now not be put back."
Other senior Leave figures declined to back Mr Farage's assessment, which he said was based on information from private exit polls conducted by friends in the City, as well as his personal sense of how referendum day had gone.
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.
The final poll of the campaign forecast a Remain victory by a margin of 52% to 48%. But the first result to be announced in the UK gave only a slender lead of 50.7% to 49.3% for Remain in Newcastle-upon-Tyne, which had been expected to give a more enthusiastic thumbs-up for EU membership.
Within moments of Sunderland opting for Leave by an emphatic 61% to 39%, the value of sterling slumped by around 3% in a sign of market concern that Britain may about to take the dramatic step of quitting the EU after 43 years. Remain racked up a number of successes in Scotland, as expected.
Some 84 Leave-backing Conservatives signed the letter to the PM, as Tories battled to restore a unity riven by weeks of divisive "blue-on-blue" fighting.
In it they wrote: "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, Theresa Villiers, John Whittingdale and Priti Patel.
But former Cabinet ministers Owen Paterson, Cheryl Gillan and David Jones did not sign, along with the chair of the backbench 1922 committee Graham Brady and influential MPs including Mr Davis and Bernard Jenkin.
Labour's Jonathan Ashworth said the Conservative Party was "utterly preoccupied with leadership infighting rather than the future of the country."
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."
A high turnout was expected in the referendum, despite torrential rain in South-East England which forced the closure of some polling stations and caused transport disruption for commuters planning to vote on their way home.
A record 46,499,537 voters were eligible to take part, said the Electoral Commission, meaning that a turnout a little over 72% could surpass the highest number of ballots cast in a general election.
Press Association analysis of turnout figures suggested that either camp will need a total of around 16,800,000 votes in order to pass the winning post and claim victory.