Voting has ended in Britain's referendum on whether or not to stay in the European Union, in the first referendum on the country’s links with Europe in more than four decades.
Results expected in the morning of June 24.
Opinion polls were too close to call after a divisive campaign that dominated headlines for months as politicians on the "leave" and "remain" sides sought to sway the U.K.'s 46.5 million eligible voters.
An online survey taken on polling day of 5,000 people suggests the "remain" side running at 52 percent of the vote, to "leave's 48 percent.
British Prime Minister David Cameron issued an impassioned appeal to national resilience to reject a so-called Brexit, telling the nation that "Brits don't quit."
Much of the debate has hinged on the economy, immigration, and what some perceive as overbearing EU bureaucratic control over issues better left to individual states.
An average of polls compiled this week by What UK Thinks showed the "remain" camp with a razor-thin lead -- 51 percent versus 49 percent for "leave" among those who have decided.
The issue emerged in the run-up to last year’s general election, when Cameron promised a referendum on EU membership if he won reelection. His pledge came in response to growing calls from his own Conservatives and the populist and anti-immigration U.K. Independence Party (UKIP), who argued the country had not held a public consultation on the issue since 1975.
On June 22, Cameron outlined his vision for a future with Britain retaining its place in the 28-nation bloc of more than 500 million people.
Cameron has repeatedly criticized the EU for losing touch with British citizens, but has said he favors Britain helping reform the EU from within.
WATCH: One Last Bid For Votes On Last Day Of U.K.'s EU Referendum
On June 22, he flatly rejected the charge that the EU is outdated.
"We are not shackled to a corpse," Cameron told the BBC. "You can see the European economy's recovery. It's the largest single market in the world."
In the event of a "remain" vote, Cameron predicted an investment surge into Britain.
Meanwhile, a late rift appeared among Brexit advocates, with one of the most prominent campaigners of the "leave" side, former London Mayor Boris Johnson, distancing himself from the anti-immigration UKIP and its firebrand leader, Nigel Farage.
Johnson on June 21 voiced disapproval of a controversial UKIP poster showing a column of nonwhite migrants massed at a European border alongside the words "Breaking Point."
Johnson told British media that the poster -- an allusion to the refugee inflow that has left the EU coping with more than 1 million migrants since last year -- had "xenophobic undertones."
Johnson insisted the "Vote Leave" campaign, which he officially represents, has nothing to do with it.
UKIP leader Nigel Farage holds his passport at a pro-Brexit event in London earlier this month.
Britain joined what was then called the Economic European Community (EEC) in 1973, following parliamentary approval and the signing of an accession act the previous year, without popular consultation.
Two years later, in 1975, Britain held a first referendum on its membership in the EEC, which at the time had only nine members.
The 1975 referendum showed support of more than 67 percent for EEC membership.
The result of the June 23 poll is not legally binding, and the British Parliament would have to vote to repeal the law that brought Britain into the bloc in the first place.
What one newspaper called "the most divisive, vile, and unpleasant political campaign in living memory" was further marred by the killing last week of lawmaker Jo Cox, a pro-EU campaigner and vocal advocate of diversity and immigrants' rights.
British Prime Minister David Cameron
Cox, who would have been 42 on June 22, was shot and stabbed to death in northern England as she was campaigning for the "remain" camp. The suspect gave his name during his first court appearance as "Death to traitors, freedom for Britain.”
UKIP leader Farage told a news conference on June 22 that the slaying was a "horrendous incident" but called on Brits to vote "to get our borders back."
Many world leaders, including U.S. President Barack Obama, Chinese President Xi Jinping, German Chancellor Angela Merkel, and NATO and Commonwealth allies, have urged Britain to remain in the EU.
And European leaders have chimed in, urging British voters to think carefully before choosing to leave the European Union.
European Commission President Jean-Claude Juncker said the outcome would be final and "out is out."
French President Francois Hollande warned an exit would be "irreversible," adding that it could seriously jeopardize Britain's access to the bloc's single market for trade in goods and services.
According to Italian Prime Minister Matteo Renzi, a so-called Brexit would be "a mistake for which you the voters primarily would pay the price."
And NATO Secretary-General Jens Stoltenberg warned that "a fragmented Europe will add to instability and unpredictability."
The official result is due on the morning of June 24 and will be preceded by partial results and turnout figures from 382 counting centers.
With reporting by Reuters, BBC, AP, and AFP