SNP ministers have demanded immigration powers after official data showed Scotland’s population growth starting to stutter, with a surge in pensioners and a fall in the workers needed to pay for public services.

New data show there is now “no natural growth” in Scotland's population, as deaths constantly outstrip births, making inward migration the sole motor of population growth.

Forecasts also suggest that, even on current migration levels, the number of pension-age Scots is due to grow by 240,000 over 25 years, while worker numbers fall by 7000.

If Brexit cuts EU migration, Scotland’s overall population could shrink, with a dramatic drop in the number of workers whose taxes would be needed to look after elderly Scots.

The Scottish Government said it showed Holyrood needed to be able to create its own immigration system, rather than having to rely on a ‘one size fits all’ UK-wide one.

According to the statistics, Scotland’s population growth is slowing down, with the country expected to grow 2.5 per cent from 5.44million people in 2018 to 5.57m in 2043.

Over this period, the number of pension age Scots is forecast to grow by 23.2%, while the working age population falls by 0.2%, or from 64 to 62% of the population.

The working age population falls by 1.9% if Brexit cuts EU migration by half, and by 3.7% if Brexit ends EU migration completely, while the rise in pensions is unaffected.

If EU migration is halved, Scotland’s population rises by just 1% to 5.49m in 2043, and if it ends, then Scotand’s population would fall by 0.5% to 5.41m over 25 years.

The UK’s population is forecast to grow by 9% from 66.4m to 72.4m by 2043 on current trends, and is far more resilient to lower EU migration.

If EU migration halves, the UK population grows by 7.7%, and if it ends it still grows 6.4%.

The UK’s working age population is also forecast to grow even if EU migration ends.

Its pension-age population is due to grow by around 29.5% under all EU migration scenarios.

Paul Lowe, chief executive of the National Records of Scotland and Registrar General for Scotland, said: “Scotland’s population is projected to continue increasing, but at a slower rate than it has done in previous years.

“Past trends suggest that there could be more deaths than births in the next few years, with migration to Scotland projected to be the only driver of population growth.

“Over the next 25 years, there are projected to be a growing number of older people, fewer children, and the working age population is projected to make up a slightly lower proportion of our total population given the expected increase to the pensionable age population.”

SNP External Affairs Secretary Fiona Hyslop said the figures underlined the potential impact that Brexit could have on Scotland’s population and services if it reduced immigration.

She said: “Our pension age population is projected to grow while our working age population falls, and could decline even further if EU migration is reduced.

“This is why Scotland needs inward migration to support our public services and economy, particularly in sectors like tourism, hospitality, construction and agriculture, but also to enrich and diversify our society.

“It is clear Scotland urgently needs powers to deliver a tailored immigration system so we can mitigate against the risks of the UK Government’s increasingly restrictive policies and ensure Scotland can continue to be a welcoming, progressive and diverse country.”

Tory MSP Annie Wells said SNP ministers should get planning for the demographic changes.

She said: “Scotland’s population has been expanding and ageing for some time, and the SNP government has been well-warned about the consequences of this. These latest figures shouldn’t take ministers by surprise, and it’s time for them to start planning.

“With previous warnings, the SNP didn’t plan the NHS or social care workforce sufficiently, and now patients and remaining staff are the ones impacted.

“The SNP government needs to make Scotland a more attractive place to live and work, and it could start by ensuring we have a fairer taxation system than the one in place currently.”

Green MSP Ross Greer said: “These figures are a stark reminder of just how essential immigration is for Scotland and emphasise the undisguised racism that underpins the UK Government’s hostile environment policy.

“Inward migration plays a vital role in enriching our society, our public services and economy depend on it and our communities are stronger for welcoming new Scots.

"We should never tire of thanking all those who choose to make Scotland their home and make clear that they are most welcome here.”

Pro-Remain East Lothian Labour MP Martin Whitefield said the figures also showed the danger of Scottish independence creating a hard-border with England.

He said: “Inward migration is essential for Scotland’s economy, with more workers paying the taxes we need to fund vital public services for a growing elderly population.

“EU migrants have made a massive contribution to the Scottish and UK economies, which is why we need a People’s Vote so that we have the option to remain in the EU and protect freedom of movement.

“But there are also hundreds of thousands of people from the rest of the UK living and working in Scotland, so the last thing we need is a hard border with England.

“The best future for the UK is to remain in the EU and the best future for Scotland is to remain in the UK, so that we can build bridges, not barriers.”