LONDON – Polls have closed in Britain in a national referendum that will decide whether the country remains a member of the European Union or withdraws.

Counting will continue through Thursday night and into the early hours of Friday in a race that has been too close to call. Opinion polls in the final weeks seesawed between the two sides.

Shortly after polling stations closed at 10 p.m. British time, Nigel Farage of the United Kingdom Independence Party, which supports a British withdrawal from the E.U., appeared to issue a concession statement, saying that he believed the “Remain” side had eked out a win. But pollsters cautioned that it was too early to make any confident prediction.

Farage’s party and other pro-“Leave” forces had mounted a fierce campaign against the E.U., contending that Britain was being swamped by European migrants and had lost control over its borders. Critics accused Farage and others of rhetoric bordering on racist and xenophobic.

“Remain” campaigners warned that a British exit from the E.U. would result in an economic meltdown and diminish Britain’s influence in Europe and beyond. The “Remain” camp received the support of British Prime Minister David Cameron and leader of the opposition Labor Party Jeremy Corbyn, President Obama, European leaders, top military officials, major business figures and most economists.

Anticipating a narrow vote to stay in, financial markets reacted favorably Thursday, with the British pound jumping to its highest level against the dollar this year.

More than 46 million people were eligible to vote in Thursday’s referendum, and preliminary estimates put turnout at about 70%, despite havoc wreaked in some parts of Britain by torrential rains. Some polling stations had to be moved from place to place because of flooding.

The last time British voters were given the chance to determine whether their country stayed in the E.U. was in 1975. In that election, two-thirds of those who voted embraced membership.