Why does Scotland have a 'black hole' in its finances?
BBCLater this week the Scottish government will set out its tax and spending plans for the year ahead, in what John Swinney has called "an age of remarkably constrained public finances".
There have been warnings from watchdogs and think tanks that his finance secretary, Jenny Gilruth, faces a challenging task in balancing the books.
The government's own medium-term financial strategy projected that spending is on track to exceed available funding by £4.8bn by 2029-30 - commonly referred to as a "black hole" which has to be filled.
Where is this pressure coming from, and how might the government look to deal with it?
Two main sources of funding underpin the Scottish budget - taxes which are under Holyrood's control, including income tax, and a block grant from Westminster.
That grant comprises Scotland's population-adjusted share of spending at Westminster on devolved issues, and there is an annual row between Scottish and UK ministers about whether it is big enough.
The UK government has insisted that John Healey's budget last month provided an extra £600m for Holyrood.
However that figure is spread over a three-year period, and Scottish ministers insist the allocation for next year has not kept pace with inflation.
They say the "real terms" figure is a cut of £650m compared to the current financial year.
That combines the "resource" budget for day-to-day spending on services and "capital" funds for investment in infrastructure.
It is true, but the Fraser of Allander Institute has pointed out that this "cut" is actually the result of money being added to Holyrood's coffers, not taken away.
Over the summer, the Scottish budget was boosted midway through the financial year by more than half a billion pounds, mostly flowing from UK government spending on schools.
That extra funding being concentrated in one year means that in comparison, there is a relative reduction the following year - despite the Scottish government being "better off overall", in the words of the FAI.
As the think tank puts it, "the reason why there is a real terms fall in 2027-28 is because they are getting more money this year".
Scottish Fiscal Commission analysis pre-dating the UK budget also confirmed that a real terms cut in the resource block grant was already expected for next year.
However those figures show that across the longer term, the grant has broadly increased in real terms since the pandemic.
By contrast the capital grant has not kept pace with inflation over that same period.
The UK government has been shifting funding to defence spending - and because defence is not a devolved issue, Holyrood does not get a share of it.
Inflation has also had a major impact on the other main source of funding for the Scottish budget - income tax.
In recent years, the Scottish government has aimed to raise more money from higher earners, arguing that those with the broadest shoulders should pay a little more for services.
They have created a six-band income tax system which aims to leave a slim majority of Scots slightly better off than those on equivalent wages in the rest of the UK - while taxing those on higher wages hundreds of pounds more.
In its 2026 election manifesto, the SNP pledged not to increase rates or introduce new bands during this term of parliament.
That doesn't mean they won't be raising more money from tax though, because they have also committed to freeze the income thresholds where the top three rates of tax kick in until 2028-29.
Holding thresholds steady rather than increasing them in line with inflation creates what is commonly termed "fiscal drag", where people see more of their earnings subject to higher rates of tax as they get pay rises.
This has been a particularly big factor in recent years, with high rates of inflation driving pay deals - and taking Scotland's total income tax revenues from £12bn in 2020-21 to almost £23bn forecast for the coming year.
Meanwhile the number of people paying the higher rate of income tax has almost tripled since income tax was devolved, from 304,000 in 2016-17 to a projected 890,000 next year.
The Scottish Fiscal Commission says that figure is set to surpass one million by 2030-31 if current policy continues.
One issue with the tax system is that it is necessarily based on forecasts for both Scotland and the rest of the UK.
But once the actual tax take has been counted up, it usually turns out the forecasts were slightly out - and the difference between prediction and reality has to be balanced out.
In several recent years that has actually meant extra money being added to the Scottish budget, but this year £720m has to be paid back.
There is an allowance to borrow more money to mitigate this, but it will not cover the full amount.
Getty ImagesIf the block grant has broadly been growing over time, and income tax receipts have increased too, then why is there still a shortfall?
The answer is that spending has gone up even faster.
Social security is one of the major areas of growth in the budget - it was £7.4bn in the current financial year, and is forecast to hit £9.2bn by 2030-31.
The Adult Disability Payment accounts for more than half of that, and disability benefits make up three-quarters of the total amid a sharp increase in claims.
Scottish ministers see no need to trim the welfare system though, despite talk of reforms in England and Wales, saying that benefits are an investment in the people of Scotland.
Another growth area has been public sector pay, which makes up more than half of the Holyrood budget.
Scotland has a larger and better-paid public sector workforce than other parts of the UK.
Two years ago, ministers set out a pay policy aiming for a total increase of 9% spread across three years.
However a succession of large settlements followed, with resident doctors agreeing a deal totalling 8% over two years.
The Scottish Fiscal Commission has calculated that deals for 2027-28 will need to average out at 1.1%, well below the rate of inflation, unless extra cash can be found.
At the same time, the workforce has continued to get bigger - despite ministers aiming to reduce it by 0.5% each year.
Gilruth has acknowledged those plans are "off course" due to growth in NHS staffing.
Press AssociationScotland's health services accounted for £20bn of the £50bn budget for day-to-day spending in 2026-27.
An aging population is driving greater demand for services which have also been impacted by inflation, while extra funds have been committed in an attempt to cut waiting times.
NHS boards have been told to target annual efficiencies of 3%, but questions have been raised about whether this can be delivered particularly as staffing continues to increase (Audit Scotland reported only three boards met the target last year).
The Institute for Fiscal Studies told MSPs that less demanding targets had been missed in the past.
Those cuts are a key part of the government's attempts to save £1.5bn over the next three years - but Audit Scotland says it is "difficult to assess the deliverability" of that vision.
The government has announced plans to reduce the number of mainland health boards from 14 to two.
This could happen quickly because it does not require legislation to be passed at Holyrood, meaning it could factor into the coming year's budget.
The government is also consulting with councils about a new structure of local government anchored in a smaller number of regional authorities, and looking at merging other public bodies.
This kind of move can save money - Police Scotland told Holyrood's finance committee that the move to a single force in 2013 had ultimately saved £2.5bn.
However it is not clear how quickly any savings could be delivered from reforms, or whether there could be up-front costs as changes are made.

Ultimately, while a "black hole" may be apparent in forecasts for future years, in practice it is closed each year because the government legally has to balance its budget.
This largely has to be done via aligning incoming cash and outgoing commitments, as it has relatively limited borrowing powers.
Ministers are expected to try something new this year by issuing bonds for capital investment as part of the upcoming budget, having secured a credit rating equivalent to the UK's.
However this will effectively replace other streams of borrowing, and may not be taken forward at all if economic conditions don't look favourable.
All of this is why the Fraser of Allander Institute says the government faces a "particularly challenging budget".
Deputy director Emma Congreve said: "Not all these issues are new or unexpected, but reconciling a real-terms fall in funding with longstanding funding pressures will make it a difficult to avoid difficult decisions on tax and spending.
"Longer-term reform matters, but it will not close the immediate funding gap. The test of this budget is whether the government explains how it will deliver public services in the coming year while setting out a credible plan for the future."
