The Scottish Government has been accused of breaking its promises on class sizes and teacher numbers.

Labour hit out after new figures show 3,690 fewer teachers than in 2007, the year the SNP came to power.

The number of P1 to P3 pupils being taught in classes of more than 26 increased to 38,278, a total of 23.2% of children in these classes, the government figures also show.

In 2012 a total of 51,410 teachers were working in Scotland, a drop of just 21 from the previous year but down from 55,100 in 2007.

At the same time the number of school students fell by around 20,000, from 692,215 in 2007 to 671,218 this year, although the number of youngsters in primary school has been increasing since 2010.

Between 2006 and September 2009 the number of P1 to P3 pupils taught in a class with 26 or more fell from 57,424 to a low of 32,702.

That happened in the wake of the SNP's 2007 election manifesto pledge to cut class sizes to 18 for children in the first three years of primary education.

But in September this year 38,278 P1 to P3 pupils were in classes of 26 or more, including 473 children being taught in classes of 31 or more.

There are now 18.8% of P1 to P3 pupils in a class size of 18 or fewer, down from 20.2% last year but up from 12.7% in 2006.

After legislation was introduced in November 2010 to limit class sizes to 25 for P1, the number of children in classes larger than this in their first year of school has fallen from 6,896 in that year to just 503 this year.

The SNP manifesto for last year's Holyrood elections promised that "over the next five years we will bring together the complex guidance and legislation on class sizes to deliver a coherent system in Scotland's schools to support progressive reductions in the youngest years".

Labour education spokesman Hugh Henry hit out at the Scottish Government.

"Alex Salmond came to power in 2007, promising to maintain teacher numbers at 54,136. He quickly ditched this and is now trying to blame local councils for the reduction. It was his promise and he has conned both teachers and parents," he said.

"The SNP Government has broken its promise to reduce class sizes in P1 to P3. Even worse in secondary schools. SNP ministers have allowed an increase in class sizes in English and maths in S1 and S2: vital transitional years for school pupils.

"The figures show the shocking reality of the SNP's broken promise on teacher numbers."

But Education Secretary Mike Russell said: "Despite pupil numbers increasing, we have almost wiped out P1 classes of more than 25. The number of P1 children in these classes has fallen by 97% since 2006 and we have made clear progress since introducing legislation.

"We are providing stability in our classrooms and have halted the decline in teacher numbers evident since 2007.

"Small class sizes are a vital part of our commitment to the early years. So, where pupil numbers are rising, I anticipate that councils will increase teacher numbers in future.

"Real progress is being made. We are delivering for our schools and our schools are delivering for their pupils. We will continue to work hard to make further improvements and, despite the difficult financial circumstances we face, we are confident we can go on delivering on our ambition to make Scotland the best place to grow up."