The discovery of oil deep beneath the waters of the North Sea has made this ancient port city an energy boom town, with some of the highest wages and lowest unemployment rates anywhere in Europe.

Now, leaders of the campaign to break from Britain in a Thursday referendum are counting on the spoils of “Scotland’s oil” to help spread prosperity across their newly independent nation, funding schools, health care and social welfare programs. Scottish First Minister Alex Salmond has promised an oil fund, modeled on Norway’s, to ensure that the country’s wealth is broadly shared.

But in the final days before the vote, that vision of a progressive and egalitarian society built on a foundation of black goo is coming up against the hard reality of energy economics: After four decades of relentless pumping, the North Sea reserves are long past their peak and could be headed for a steep decline.

Diminishing production means that even if Scotland breaks free from the rest of Britain with Thursday’s vote, it may be too late to reap most of the gains. And instead of coming out ahead, the fledgling nation could have to contend with a gusher of red ink.

“The early to mid-1980s was when Scotland would have done extremely well if it had had all the oil,” said John McLaren, an energy economist with Fiscal Affairs Scotland. “But there’s no prospect of it getting to anything like what it was in the past.”

On Sept. 18, voters in Scotland decide whether or not to end their 307-year union with England and become the newest independent nation in the world. Truth Teller puts campaign ads for and against Scottish independence to the test. (Davin Coburn/The Washington Post)

Doubts about the North Sea are just one piece of a broader constellation of economic concerns that has shaped the independence campaign in its final days. While Scotland’s 4 million voters will weigh many factors when they decide whether to break up their three-century-old union, much of the debate comes down to money.

And on that issue, much remains unknown. Even the basic question of which currency will fill Scots’ pockets remains hotly debated, with Scottish leaders saying they will continue to use the pound, but British officials insisting that they won’t share.

The uncertainty has prompted an outcry in recent days from big business. Several large companies — including the Royal Bank of Scotland — have said that they will move their headquarters south of the border if Scotland breaks away. Retailers have warned Scottish voters that a “yes” vote will force them to raise prices. Oil company executives have maintained they want to keep drilling amid the stability of Britain.

But none of that seems to have swayed large numbers of voters: Polls show that the margin in the referendum remains razor thin, just as it was before the blitz of corporate dismay.

To independence advocates, the expressions of anxiety are all part of a carefully orchestrated campaign by the British elite to scare Scots away from going it alone.

Few doubt that Scotland could make it as an independent country, with banking, tourism and whiskey all contributing to a diversified economy that would lean substantially on oil but not be completely reliant on it. Independence advocates point to statistics showing that an independent Scotland would rank as the 14th-wealthiest country in the world per capita, higher than Britain, with oil and gas accounting for about 15 percent of economic output.

But if Scotland is going to come out ahead from a decision to leave the rest of Britain behind, oil will be key. And it will need either greater production or higher oil prices just to make up for the money lost because of the greater relative cost of government services to the geographically dispersed population of Scotland.

While campaigning door-to-door in Aberdeen on Friday, Salmond ridiculed suggestions that North Sea oil may be running low and asserted that there is enough to help fill government coffers for “many, many decades to come.”

Britain, he said, had consistently squandered revenue from oil taxes; Scotland, he said, would bank it to ensure that future generations of Scots benefit, much like the similarly sized country across the water that has grown rich off oil.

“If we want an example of how to manage a great natural resource, we just have to glance across the sea to our friends in Norway,” said Salmond, who worked as an oil economist before entering politics.

But Norway, which has a ­trillion-dollar sovereign wealth fund that is the envy of Europe, has had a crucial 20-year head start.

Most of Scotland’s recoverable North Sea oil is gone, with 40 billion barrels pumped since the first discovery in 1970 and production in decline since 1999.

Estimates of how much is left vary but tend not to exceed 24 billion barrels. Ian Wood, a billionaire North Sea pioneer, recently said that 16 billion barrels is more likely and that production could dramatically decline within as little as 15 years.

“Young voters right now should just be aware by the time they are middle-aged, they’ll ­begin to see a real rundown not just in the level of oil and gas being produced but the ongoing implications of that — the jobs, economic prosperity, public ­services,” Wood told ­EnergyVoice.com.

That knowledge may help explain why in this affluent, ­granite-hewn city, where nearly everyone seems to have a job in the petroleum business, support for independence tends to lag. Many voters in Aberdeen say they are all too aware that the oil is fleeting.

“Aberdeen is a bubble,” said Robbie Tennent, a 24-year-old engineer who specializes in maintaining the pumping platforms that rise hundreds of miles offshore. “It’s great to have oil. It keeps me employed. But I don’t think you can base your economy around it.”

Tennent, who was out campaigning for the unionists one recent evening, said his own success gives him special pause: Companies need people like him to fix aging oil platforms because they are unwilling to spend money on new ones. “There’s not enough oil for them to reinvest,” he said.

And yet, there’s always the prospect of new discoveries. Alexander Kemp, a professor of oil economics at the University of Aberdeen, said that dozens of underexplored fields off the Scottish coast that aren’t commercially viable now may become so if the price of oil rises and the cost of extraction falls.

Many residents, meanwhile, have grown inured to warnings of vanishing oil. Kenneth Anderson moved to a booming Aberdeen in 1977 to work in construction and can remember talk about an imminent bust. “Even then we were told the oil was running out,” he said.

Nearly four decades later, he owns a thriving construction company that builds state-of-the-art facilities for the energy firms that continue to congregate around Aberdeen’s nearly ­millennium-old harbor.

But the city could have done even better if it had been governed from Edinburgh, not London, Anderson said. And he worries that unless Scotland takes control of its destiny, his three kids won’t have the same prospects that he did.

“If they go off to Berlin or Tokyo or San Francisco or London, that’s fine. I don’t want to stifle them,” said Anderson, 55. “But I would like opportunities for them to exist here in Scotland.”

Karla Adam in London contributed to this report.