Almost one in ten Scottish schools ended the last academic year with a financial deficit, after total overspending of £5.7million, new figures have revealed.

However, the total is likely to be higher as four of Scotland’s 32 councils failed to respond to freedom of information requests.

The data showed at least 238 of Scotland’s 2,461 state schools ended the 2021/22 academic year with their budget in the red.

The Scottish Liberal Democrats, who obtained the figures, said it was “shocking” to see so many schools had been forced into the red by budget pressures.

They also highlighted the way many councils use accounting procedures to say that none of their schools are technically in deficit or have a “true overspend”.

Read more: Wider support for independence saving SNP from 'cataclysmic' collapse

Scotland had 1,994 primary schools, 358 secondaries and 109 special schools in 2021/22.

The authority with the largest deficit figure was Aberdeenshire.

Of its 165 schools, it reported 60 were in deficit to a total of £2,228,114.

Other councils with substantial deficit totals were Dumfries & Galloway at around £630,000 for 22 of its schools; Scottish Borders at £558,870 for 22 of its schools; City of Edinburgh at £562,476 for seven of its schools; Fife at around £430,000 for nine schools; Argyll & Bute at £392,673 for 38 of its schools and Orkney Island Council at £334,243 for nine of its schools.

The total deficit across all Scottish state schools in 2021/22 was £5,674,742.

Scotland’s state schools operate within devolved management guidelines agreed between the Scottish Government and the council umbrella body Cosla.

HeraldScotland: Scottish LibDem education spokesperson Willie Rennie said the figures were shockingScottish LibDem education spokesperson Willie Rennie said the figures were shocking

Headteachers are required to manage a delegated budget in a “fair, equitable and transparent way” in liaison with their local authority.

However, within this framework, there is wide variation across councils on the ability of heads to move money between budget pots and on financial reporting. 

Scottish LibDem education spokesperson Willie Rennie said: “It is shocking to see hundreds of schools across the country reporting budget deficits. We know parents are being asked to contribute to school funds out of their own pockets, that schools are considering closing early and that subjects are being dropped from the curriculum.

“Ministers need to make sure that schools, teachers and pupils have the resources they need to flourish. 

“The government must urgently address these funding pressures that are impacting on children's education and leaving schools struggling to make ends meet.”

Read more: Anas Sarwar refuses to back Glasgow Labour leader ahead of challenge

The LibDems also queried whether the accounting procedures used by some councils claiming they had no schools in deficit were artificial and underplayed the issue.

Glasgow City Council said it had no schools in deficit as spending more on staff wages than its budgeting formula implied would never be classed as a “true overspend”.

East Dunbartonshire Council said it had no schools with a financial deficit at the end of 2021/22 as “any financial overspends” were met by the council.

Western Isles Council, which said it no school was in financial deficit, nevertheless used extra Scottish Government funding in the pandemic to “flatten out overspends and underspends across the Education Department”, which ended 2021/22 in credit. 

Scotland’s largest teaching union, the EIS, said it had been raising concerns about “the under-funding of Scottish education for many years”.

A spokesperson said: “Education is an investment in our young people and in our country’s future and it must be properly funded, to ensure sufficient specialist staffing, adequate resources for learning and fair pay for all staff. 

“The results of the recent EIS national teacher survey confirmed the extent to which teachers are propping up the education system with their own money and through unpaid additional work, and this is simply not sustainable. 

“Education was once proclaimed the number one priority for the Scottish Government, but the level of investment in our education system has failed to live up to that billing.” 

Aberdeenshire Council wa asked for comment.

A Scottish Government spokesperson said: "The delivery of education is the responsibility of local authorities, who manage their own budgets.

“Local authorities allocate the total financial resources available to them, including setting school budgets, on the basis of local needs and priorities, after fulfilling their statutory obligations and the jointly agreed set of national and local priorities.

“The Scottish Government has increased the resources available to local government in 2023-24 by more than £793 million, a real terms increase of £376 million or 3%, compared to the 2022-23 Budget figures.”