The schools minister has been forced to cancel a national spelling test for England's primary schools, after a teacher spotted it had already been published online as a practice paper.

Nick Gibb said this was a "clearly regrettable incident".

More than half a million seven-year-olds had been due to take the test next month, as part of their Sat tests.

Head teachers' leaders, who had called for the scrapping of the test, welcomed the decision.

It follows the discovery that part of the English test paper had been mistakenly published on the Department for Education's website, for use as practice material, and had been available there for three months - potentially giving some pupils a clear advantage.

The blunder was initially spotted by a teacher at a school that was carrying out an official trial of the test, using the paper that was to be taken by pupils around England.

"We have no way of knowing how extensively it has been used by schools and parents," said Russell Hobby, the leader of the National Association of Head Teachers.

Mr Hobby said the schools minister had acted "quickly and appropriately" in cancelling this part of the Sats tests for seven-year-olds.

Mr Gibb issued a statement saying: "To remove any uncertainty and clarify the situation for schools, I have decided that we will remove the requirement on them to administer the Key Stage 1 grammar, punctuation and spelling test for this year only."

He said that no other test papers for Key Stage 1 pupils appeared to have been affected.

The schools minister also announced there would be a "root and branch inquiry" into the Standards and Testing Agency, an agency of the Department for Education that sets tests.

A statement from the Standards and Testing Agency said the mistaken publishing of the words to be tested, rather than another sample, was the result of "human error".