Standardised testing for primary pupils is to be introduced by the Scottish Government to measure attainment in schools, the First Minister has announced.

Nicola Sturgeon said further details of a new "national improvement framework" will be revealed in her Programme for Government, due to be unveiled when the Scottish Parliament returns in September.

She confirmed the results of the testing would be published, meaning they could be used by others to create school league tables.

The majority of Scotland's local authorities already use some form of assessment to judge pupils' progress, but different systems means building a national picture of attainment is difficult.

In a speech on the Government's plans for education at the Wester Hailes Education Centre in Edinburgh, the First Minister said 30 out of 32 councils use standardised assessment for primary and lower secondary pupils.

"Standardised assessment helps teachers - it provides useful information to support their own judgement of children's progress," she said.

"But many local authorities use different systems. That makes it much more difficult to get a clear and consistent picture of progress.

"That's why we are now developing a national improvement framework. I will say more about the framework - and in particular how it will address this issue - when I set out my Programme for Government two weeks today.

"The basic purpose of the improvement framework will be to provide clarity on what we are seeking to achieve and allow us to measure clearly where we're succeeding and where we still need to do more.

"By doing that, it will enable us to raise standards more quickly. As a result, it will help to change the future for young people across Scotland."

Ms Sturgeon admitted that the information, which will be published, could be put into league tables by others.

"That's not the purpose for which we are doing it," she said.

"There will be some further information about how information will be published and in what form to make it most useble and useful, but the idea that in the age of freedom of information that you could gather information like that and not publish it would be not tenable."

The announcement comes after new Scottish Labour leader Kezia Dugdale called for a return to national testing in primary schools earlier this month. The move is also backed by the Scottish Conservatives.

School league tables and national testing for five to 14-year-olds was scrapped in Scotland in 2003.

During her speech, Ms Sturgeon also revealed that a further 57 schools are to receive funding from the £100 million Attainment Scotland Fund to improve literacy, numeracy and health and wellbeing for primary-school pupils.

The total number of primary schools benefiting from the fund is now more than 300 and several local authorities are using the cash to recruit more teachers.

The funding is part of the Scottish Government's wider strategy to close the attainment gap.

The SNP administration has come under fire over claims that literacy and numeracy levels are falling in some age groups while opposition parties say the Government has failed to make significant progress after eight years in power.

"My aim - to put it bluntly - is to close the attainment gap completely," Ms Sturgeon said.

"It will not be done overnight - I accept that. But it must be done. After all, its existence is more than just an economic and social challenge for us all. It is a moral challenge.

"Indeed, I would argue that it goes to the very heart of who we are and how we see ourselves as a nation."

Scottish Liberal Democrat education spokesman Liam McArthur said: "This is a sop to the Tories which will only heap more work on the plates of teachers.

"It will impose an undue amount of stress on the young people we should be encouraging to enjoy learning.

"It seems that the SNP is now preparing the ground for school league tables. This is a backwards approach Scotland has long rejected and will do little to help close the attainment gap."

Larry Flanagan, general secretary of the EIS teaching union, said: "The EIS will be happy to engage in discussions regarding the best use of assessment data within the national improvement framework.

"However, we need to be cautious over placing too much emphasis on any single measure of performance - teachers use a range of assessment approaches to support their professional judgement, ensuring that assessment supports learning in the classroom."

Scottish Labour's education spokesman Iain Gray said: "The attainment gap in our schools should be a worry to every single Scot.

"There should be no return to the national testing of the past, but the current situation is unacceptable too.

"It's welcome that the First Minister has echoed Kezia Dugdale's suggestion last week for a national framework, but it is now months since the First Minister first said all of this was her priority. She needs to get on and do it."

Scottish Conservative young people spokeswoman Liz Smith said the SNP's record in education is "a miserable failure".

"When they see falling rates of literacy and numeracy, a widening attainment gap between rich and poor, cuts to teacher number and 140,000 fewer college places, they know something is very badly wrong and the blame lies entirely at the door of a Scottish Government which has become obsessed with the wrong priorities," she said.

In a further statement released by the EIS, Mr Flanagan said the union remains "opposed to any suggestion of a national testing system which would inevitably lead to teaching to the test and the construction of flawed and misleading league tables".