Scotland has voted on whether to stay within the United Kingdom or break the 307-year-old union in a finely balanced independence referendum with global consequences.
Its verdict should be clear around breakfast time on Friday.
Polling booths closed at 2100 GMT from remote highlands and islands to the tough city estates of Glasgow with surveys suggesting Scots were almost equally divided in a vote watched closely by Britain's allies, investors and restive regions at home and abroad.
Recent opinion polls gave the "No" campaign - those in favor of remaining in the United Kingdom - a slight edge. But as many as 600,000 people undecided up to the last moment held the key.
The final poll of polls by the non-partisan “What Scotland Thinks” website, put the No campaign on 52 percent, the Yes camp on 48. That measure has never given the independence campaign a lead despite a sharp narrowing in recent weeks.
The gap is sufficiently close that if the pollsters have got it marginally wrong, Scotland could go its own way.
Financial markets lodged a raft of late bets that Scots would reject independence, pushing the pound and Scottish-based stocks higher in the final hours of polling.
Analysts say that means there will be a far more dramatic market reaction to a “Yes” vote than if Scotland opts to stay part of the United Kingdom.
French President Francois Hollande said the vote would be decisive for Europe as well as Britain. "After half a century of building Europe, we risk entering a period of deconstruction," he said on Thursday.
Those in favor say such fears are overblown. They see a bright future for an independent Scotland in Europe, a fairer society and strong ties with London.
Those opposed say a split would slow economic growth, diminish the United Kingdom's international standing, threaten the unity of other countries and tip the balance in favor of people who want Britain to leave the European Union.
Many people see the choice, which has divided families and friends but also electrified a country of 5.3 million, as one of hearts versus heads.
Tennis star Andy Murray sent a powerful last-minute message in support of the pro-independence "Yes" vote, tweeting "Let's do this".
Alex Salmond, the 59-year-old nationalist leader, told hundreds of supporters in Perth at a final rally: "This is our opportunity of a lifetime and we must seize it with both hands."
Salmond has said Queen Elizabeth should stay on as Queen of Scots. She has remained above the fray, in keeping with the constitution, but said on Sunday she hoped Scots would choose "carefully".
Electoral officials said the result will be announced around sunrise on Friday when all regional votes have been submitted. But partial results will give a strong indication after the count of cities such as Glasgow are declared around 0400 GMT.
With more than 486,000 voters, Glasgow is crucial. Edinburgh and Aberdeen, which with Glasgow make up nearly a quarter of the electorate, are also expected around about that time.
Some currency traders in London prepared to stay up all night to buy or sell sterling on the result.
WHAT WOULD BE LEFT?
The prospect of breaking up the United Kingdom, the world's sixth-largest economy and a permanent member of the United Nations Security Council, has prompted citizens and allies alike to question what would be left, while the financiers of the City of London have warned of market turmoil.
British politicians, banks and businessmen have closed ranks to warn of economic hardship, job losses and investment flight should Scots decide to go it alone.
Defense would also be a big question. Britain's submarine-borne nuclear arsenal, part of NATO's defenses, is based in Scotland's Firth of Clyde and the nationalists want it gone.
The United States has made clear it wants the United Kingdom, its main ally in Europe, to remain together.
"The UK is an extraordinary partner for America and a force for good in an unstable world. I hope it remains strong, robust and united," U.S. President Barack Obama said.
Facing the biggest internal threat to the UK since Ireland broke away nearly a century ago, Prime Minister David Cameron will inevitably face calls for his head should he lose Scotland.
Salmond has employed a mix of shrewd calculation and nationalist passion to haul the "Yes" campaign from far behind to within a whisker of winning his dream of an independent Scotland.
The 47-year-old Cameron has conceded his privileged English background and Conservative politics mean he is not the best person to win over Scots, although he has made emotional appeals for Scotland to stay in Britain's "family of nations".
That has left the leadership of the unionist case to the opposition Labour party, the only party with the local support capable of checking the secessionist Scottish National Party.
Former Labour Prime Minister Gordon Brown, a Scot who has in recent days led the battle cry for the union, warned Scots on Wednesday that Salmond was "leading us into a trap".
"Say to your friends, for reasons of solidarity, sharing, pride in Scotland, the only answer is vote 'No'," an emotional Brown thundered, fists clenched, to cheers from unionist supporters.
In the event of a vote for independence, 18 months have been inked in to decide the terms of separation but there is no agreement on key issues such as whether Scotland could retain the pound and how to carve up North Sea oil revenues.
European leaders have warned that an independent Scotland would have to apply to rejoin the European Union and could face resistance. Spain has been especially vocal, fearing it would further inspire separatists in Catalonia and the Basque Country.
Scotland says it will use the pound after independence, but London has ruled out a formal currency union.
Salmond has accused London of orchestrating business leaders to spook Scots after firms from oil giant BP to financial services group Standard Life cautioned about the risks of independence and banks said they would move south.
To blunt Salmond's argument for breaking away, Britain's rulers promised to guarantee Scotland high levels of state funding and grant Scots greater control over finances.
That pledge has angered Westminster lawmakers.
British leaders accept that whichever way the vote goes, the United Kingdom's structure will have to change, as granting more powers to Scotland will provoke calls for a less centralized state from voters in England, Wales and Northern Ireland.
(By Guy Faulconbridge and Angus MacSwan; Additional reporting by Alistair Smout in Edinburgh, Writing by Mike Peacock)