FEWER than three out of five of Scotland's most disadvantaged pupils achieve expected standards in literacy by the time they leave primary school.

Official figures show only two-thirds of the same group are meeting the expected levels of numeracy.

However, overall standards in reading, writing and numeracy are rising and the attainment gap between the richest and poorest has narrowed slightly in some basic skills.

Closing the poverty-related attainment gap is one of the key political aims of the Scottish Government, but progress has stagnated in recent years.

John Swinney, the Education Secretary, said he was encouraged to see the gap had "narrowed slightly".

"There is an increased proportion of primary pupils assessed as achieving the expected levels of Curriculum for Excellence by up to four percentage points.

"While it is too early to draw direct conclusions from this data, I am encouraged to see the attainment gap has also narrowed slightly."

However, the slow progress came under fire from political opponents. Liz Smith, the Conservative education spokeswoman, described the figures as "grim".

She said: "The fact one in three pupils is leaving primary school without reaching basic standards in literacy is the main worry. These literacy figures aren't just bad news for the prospects of youngsters, but bad for the future economy too."

Iain Gray, education spokesman for the Scottish Labour Party, criticised the "utter failure" of the Scottish Government to tackle attainment.

He added: "SNP ministers claim education is the top priority, but these figures show the poorest young people are being failed badly."

However, Larry Flanagan, general secretary of the Educational Institute of Scotland teaching union, said the improvement was good news.

He said: "These impressive levels of achievement are a credit to the hard work of pupils and teachers across Scotland.

"This success also demonstrates that, despite soaring workload and declining pay, Scotland’s teachers are still going the extra mile."

The figures also show the number of teachers in Scottish schools has risen to its highest level since 2010 after a significant decline.

The Scottish Government figures showed schools employed 51,138 full time equivalent teachers after an increase of 447 from the previous year.

However, nearly 1,000 teachers are being paid for by the Pupil Equity Fund (PEF) and are therefore on less secure contracts than the rest of the workforce.

PEF is a Scottish Government initiative to target more resources at schools serving poorer communities, but it is not supposed to pay for core activities.

Mr Flanagan said: "The Scottish Government lauds the fact teacher numbers are now at their highest level since 2010, but we also have a large increase in the number of pupils which means pupil-teacher ratios remain at an absolute standstill.

"At primary level the data is inflated by the inclusion of a growing number of teachers funded through PEF. These posts, valuable though they are, are short-term only and not guaranteed to be retained in future years.

"These posts were always intended to be additional resource on top of the existing teacher workforce and if you strip them out there are just over 51,000 teachers in Scotland, compared to more than 55,000 in 2007."

The EIS also attacked a continuing decline in the number of qualified teachers working in nurseries.

Ross Greer, education spokesman for the Scottish Greens, said thousands of teachers had been cut since the SNP came to power in 2007.

He added: "Most of the new staff are on temporary contracts paid for using limited pots of attainment funding, which explicitly cannot be used to replace lost classroom teaching posts. 

"This is an attempt to paper over the cracks, when SNP ministers should be tackling the real issue – local councils need greater powers to raise more funds to support our schools.”

Tavish Scott, Liberal Democrat education spokesman, added: "These figures show the SNP Government deserves an "F" for the delivery of its flagship class size policy."

However, Mr Swinney said teacher levels were the highest this decade and the number of primary teachers was the highest since 1980.

He said: "The average size of P1 classes has been dropping consistently in recent years, which is particularly important as helping children in the early years is crucial if we are to close the attainment gap."

The figures also show 86.6 per cent of school buildings were in a good or satisfactory condition in April 2018, up from 81.7 per cent in April 2012.

For the first time, more than 600,000 pupils are educated in schools classed as good or satisfactory condition.