Opinion polls suggest that Britons have voted in a referendum to stay in the European Union, but the first few official results on Friday put the 'Brexit' campaign ahead, prompting wild swings in the value of the pound.
With results in from the first five of 382 voting districts, those in favor of ending Britain's 43-year membership had a small lead of 3,207 votes, though it was far too early to discern a reliable trend.
Opinion surveys pointed to a vote to Remain, and two prominent anti-EU campaigners acknowledged they looked likely to lose.
Nigel Farage, head of the UK Independence Party and a leading voice in favor of leaving the EU, told Sky News: "It's been an extraordinary referendum campaign, turnout looks to be exceptionally high and looks like Remain will edge it."
Farage said his prediction was based on "what I know from some of my friends in the financial markets who have done some big polling." Government minister Theresa Villiers, who also campaigned for Britain to leave, told Sky News her instinct was that the Remain side had won.
Farage's comments and pro-Remain opinion polls pushed the pound to his highest level this year, above $1.50. But it then plunged after the vote count in the northeastern city of Sunderland showed a stronger-than-expected vote in favor of taking Britain out of the EU.
Sterling fell more than six cents, diving as low as $1.4351 before recovering to around $1.4540 in extremely volatile and illiquid trading.
A vote to stay would come as a massive relief to Britain's 27 EU partners, who had feared the departure of the bloc's second biggest economy would weaken Europe's global clout and fuel the rise of eurosceptic movements in other countries.
Prime Minister David Cameron had urged Britons to vote Remain, warning that the alternative was a leap in the dark that would hurt trade and investment, bring about a self-inflicted recession, undermine the pound and push up shopping bills and the cost of holidays.
Advocates of going it alone said a 'Brexit' would invigorate the economy by freeing business from suffocating EU bureaucracy, and allow the country to recover its sovereignty and regain control of immigration.
Before a single result had emerged, a survey by pollster YouGov showed Remain ahead by a margin of 52 to 48 percent. Unlike a classic exit poll, it was based on online responses by a pre-selected sample of people rather than a survey of voters as they left polling stations.
Pollster Ipsos-MORI also put Remain in the lead, saying that surveys it had carried out on Wednesday and Thursday gave it a 54-46 margin of victory. An Ipsos-MORI poll published earlier had just a 52-48 split for Remain.
"It's early days and there will be twists and turns through the early hours of this morning but, for now, the markets have taken that YouGov poll as a strong indication that the Remain camp has won," said Jeremy Cook, chief economist at international payments company World First in London.
A vote to stay would would leave the EU intact, with its most free-market proponent still a member. However, what began as a domestic political gambit by Cameron has polarized the country and exposed wider challenges facing Europe: public angst over immigration and the falling living standards of many in the world's richest region.
Marred by the murder of a pro-EU UK politician, Jo Cox, who was shot and stabbed in the street a week ago, the campaign and its divisive rhetoric highlighted the populist wave also seeping into the U.S. election race.
A defiant Farage said he was not conceding defeat, even though he feared the result would go against him.
"I hope I am wrong, I hope I am made a fool of, believing that to be the case. Either way, whether I am right or wrong, if we do stay part of this union it is doomed, it is finished anyway. If we fail tonight it will not be us that knocks out the first brick from the wall, it will be someone else," he said.
Ralph Brinkhaus, a senior ally of German Chancellor Angela Merkel and deputy parliamentary floor leader for her conservatives in the Bundestag, told Reuters: "The released polls show the expected neck-and-neck race. It will remain exciting until the early morning hours. I hope that the British have decided against a Brexit."
If it votes to stay, Britain has been promised a special status exempting it from any further political integration, but European leaders will still have to address a sharp rise in euroscepticism across the continent.
A Brexit vote, however, would deal a potentially fatal blow to the career of Cameron, who called the referendum and campaigned for the country to stay in, against a Leave camp led by rivals from within his own Conservative Party.
"Thank you everyone who voted to keep Britain stronger, safer and better off in Europe - and to the thousands of Remain campaigners around the UK," Cameron said on Facebook.
In a letter, 84 eurosceptic Conservative lawmakers called on Cameron to remain prime minister regardless of the result. It marked the first attempt to heal the deep rifts that have opened up in the ruling party since the start of the campaign.
The signatories included prominent Leave campaigners Boris Johnson, the former mayor of London, and Michael Gove, a cabinet minister and personal friend of Cameron.
But despite the statement of loyalty, Cameron would face huge pressure from the country at large to step down as prime minister if Britons have defied him and voted to leave.
Results are due to be announced throughout the night.
The vote came on a day when London and parts of southeast England were hit by torrential rain, causing floods and widespread transport chaos.
Five London polling stations opened late as staff struggled to get there, and two closed briefly because of flooding but were re-opened in back-up locations. Local media reported some voters had to wade through water to reach a polling station.
"In London/southeast and want to vote in the #EURef? Make sure you plan now to get back to your local polling station by 10pm!" the Electoral Commission said during the evening on Twitter as commuters struggled with train cancellations.
Among those affected was Johnson, who cast his vote with just 25 minutes to spare after returning to the capital from his daughter's graduation in Scotland.
"Let's see, let's see. It's in the hands of the people now," he said when asked how he felt about the vote.
(Additional reporting by Estelle Shirbon, Sarah Young, Ana Nicolaci da Costa, Michael Holden, Freya Berry, Ian Chua and Michael Nienaber; writing by Mark Trevelyan; editing by Mark John)