By Guy Faulconbridge and Alistair Smout

EDINBURGH (Reuters) - Just hours before Scotland's independence referendum, the fate of the United Kingdom rests on hundreds of thousands of wavering Scottish voters, as opinion polls showed supporters of the 307-year union just a whisker ahead of secessionists.

In an intense final day of campaigning on Wednesday, leaders of both sides beseeched Scots to seize the reins of history in a vote that has divided families, friends and lovers but also electrified this country of 5.3 million.

From the remote Scottish islands of the Atlantic to the toughest city estates of Glasgow, voters will be asked on Thursday to answer "Yes" or "No" to the question: "Should Scotland be an independent country?".

Five surveys - from pollsters YouGov, Panelbase, Survation, Opinium and ICM - showed support for independence at 48 percent, compared with 52 percent for the union.

An Ipsos MORI poll showed it even closer at 49 percent to 51 percent, while a second Survation poll, conducted by phone, showed unionists at 53 percent and separatists at 47 percent.

The surveys also showed as many as 600,000 voters remained undecided with just hours to go before polling stations open at 0600 GMT on Thursday.

"This is our opportunity of a lifetime and we must seize it with both hands," Alex Salmond, Scotland's 59-year-old nationalist leader, told hundreds of supporters waving the white on blue Scottish flag who chanted "Yes we can."

"Scotland's future must be in Scotland's hands," Salmond said in Perth, a city in eastern Scotland 460 miles (740 km) north of London.

Invoking 18th-century economist Adam Smith and Scotland's greatest poet, Robert Burns, Salmond implored Scots to ignore warnings from London: "Don't let them tell us we can't. Let's do this now."

With a mix of shrewd calculation and nationalist passion, Salmond has hauled the "Yes" campaign from far behind to within a few percentage points of winning his dream of an independent Scotland.

Story continues

Facing the biggest internal threat to the United Kingdom since Ireland broke away nearly a century ago, Britain's establishment - from Prime Minister David Cameron to corporate bigwigs and the princes of pop-culture - have united in a last-ditch effort to convince Scots that the United Kingdom is "Better Together."

Cameron's job could be on the line if Scotland breaks away, but the 47-year-old prime minister has conceded that his privileged English background and Conservative politics mean he is not the best person to win over Scots.

That has left the leadership of the unionist case in the hands of the opposition Labour party, winner of 41 Scottish seats in the 2010 British election and 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 in Glasgow, Scotland's biggest city and a crucial battleground, that Salmond was "leading us into a trap."

"Have confidence, stand up and be counted tomorrow," Brown thundered, fists clenched, to applause and cheers from unionist supporters. "Say to your friends, for reasons of solidarity, sharing, pride in Scotland, the only answer is vote 'No'."

A UNITED KINGDOM?

In the event of a vote for independence, Britain and Scotland would face 18 months of talks on how to carve up North Sea oil and what to do about European Union membership and Britain's main nuclear submarine base.

Scotland says it will use the pound after independence, but London has ruled out a formal currency union, while Britain will have to decide what to do about the nuclear submarine base on the Clyde, which the nationalists want to evict.

The prospect of breaking up the United Kingdom, the world's sixth-largest economy and a veto-wielding permanent member of the United Nations Security Council, has prompted citizens and allies alike to ponder what would be left, while the financiers of the City of London have warned of market turmoil.

Salmond has accused London of orchestrating a campaign by business leaders aimed at spooking Scots after businesses from BP to Standard Life cautioned about the risks of independence.

The United States has made clear it wants the United Kingdom, it 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," President Barack Obama tweeted.

In England, Cameron admitted to the Times newspaper that he woke up at night sweating over the possibility of defeat in Scotland.

"We have set out how Scotland can have the best of both worlds," Cameron told reporters later.

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.

British leaders accept that even if Scotland votes to keep the union, the United Kingdom's structure will have to change, as granting further powers to Scotland will provoke calls for a less centralised state from voters in England, Wales and Northern Ireland.

TOO CLOSE TO CALL

Five of the polls showed nationalists had gained ground, but supporters of the union were slightly ahead in all seven polls as some currency traders in London prepared to stay up all night on Thursday to buy or sell sterling on the results of the vote.

U.S. Treasury Secretary Jack Lew said there were potentially significant economic ramifications from the vote and that a strong United Kingdom was important.

British finance minister George Osborne last week cancelled a trip to a G20 meeting of finance ministers in Australia while Bank of England Governor Mark Carney will be in London for the result of the Scottish vote.

One poll, from Panelbase, showed support for independence had slipped to 48 percent from 49 percent, while YouGov, which had the biggest sample of the campaign, had support for independence unchanged at 48 percent.

In an indication of how close the vote is, the Scottish edition of Rupert Murdoch's Sun newspaper declined to take sides. As Scotland's best-selling daily, its stand had been eagerly awaited, but its banner headline said "Yes or No. Today Scotland starts with a blank page."

Hundreds of independence supporters rallied in Glasgow on Wednesday, chanting "Yes, we can and we will" and listening to speeches by activists on the steps in front of the Royal Concert Hall.

Supporters of the union also rallied in the city, imploring voters to "Love Scotland. Vote no." Unionists will campaign through the night.

With more than 486,000 voters, Glasgow is a crucial battleground, and the way its traditional Labour supporters go could be decisive.

Electoral officials said the result of the vote is expected by breakfast time on Friday morning, but partial results will give an indication of the trend after the count of major cities such as Glasgow are declared around 0400 GMT.

Edinburgh and Aberdeen, which with Glasgow make up nearly a quarter of the vote, are also expected around about that time. Helicopters will fly from specially lit landing sites from remote islands.

Police played down the prospect of violence, and the leaders of both campaigns have said they will accept the will of the people no matter what the result and seek to work for Scotland.

In such a tight vote, the will of the people could depend on swaying those who even at this late hour have not made up their minds.

"I am still undecided," voter Karen Wood told Reuters in Edinburgh on Wednesday. "At the moment it is just the uncertainty of what Scotland has got in store for everyone. It’s worrying. It is just such a huge decision to make."

(Writing by Guy Faulconbridge, additional reporting by Angus MacSwan in Edinburgh, Dylan Martinez in Perth, Kate Holton and Andrew Osborn in London; Editing by Anna Willard, Will Waterman and Steve Orlofsky)