The number of teachers working in Scottish schools has risen by more than 500 in a year, official figures show.

A total of 51,530 teachers were employed in primary, secondary and special schools in 2017.

Teacher numbers are up overall by 543, with 500 of the new roles being funded directly through the Scottish Government's new attainment fund.

Additional money has been given to head teachers through the fund to spend how they see fit, including extra staff.

Despite the rise, teacher numbers remain well below levels set a decade ago when the SNP formed its first devolved administration in 2007 when the figure was 55,083.

Education secretary John Swinney hailed the new statistics as "good news for teachers, parents and pupils".

He said: "Education is this government's number one priority and we are investing heavily to ensure every child in Scotland has an equal chance to realise their full potential.

"This investment is improving education - we have more teachers in Scottish classrooms, better quality school buildings and the vast majority of children in S3 achieving the minimum attainment level expected of them or better.

"And, we can now see that our decision to give head teachers more money and more power to decide for themselves how to close the attainment gap is paying off.

"Hundreds of additional teachers are now in Scottish classrooms, benefiting pupils the length and breadth of Scotland, as a result of that decision."

The statistics also revealed the average size of P1, P2 and P3 classes fell this year compared to the previously year.