The Department for Education (DfE) did have an agreement in place to share pupil nationality data with the Home Office for immigration purposes, Schools Week can exclusively reveal.

However, documents finally seen by the paper after a several month freedom of information battle, show the policy has been overturned and no nationality information about any pupil will now be shared with the Home Office.

From September, schools were asked to collect the nationality and birth country of each pupil as a compromise won by the DfE to curb stricter proposals from Theresa May.

The former home secretary wanted teachers to carry out immigration checks and schools to “deprioritise” places for the children of illegal immigrants.

Until today it was not known the education department had ever agreed to hand over the nationality data of pupils requested by the Home Office.

The Home Office has always been able to request less controversial additional pupil details – such as address and school name – and documents seen by Schools Week suggest around 1,500 requests are made each month.

A timeline in the document suggests the nationality data was added to the data-sharing agreement last year following the compromise, but confirms it was not removed until the latest version was created on October 7.

Officials have now confirmed the previous agreement “did state that DfE would provide nationality information to the Home Office”, but that this was changed “following discussions” between the two departments.

The removal of the reference to pupil nationality took place after several Schools Week stories highlighting implementation problems – including some schools asking for passports, or asking all non-white pupils to register at an office.

Angela Rayner (pictured right), the shadow education secretary, said the fact the agreement appears to have been changed “late in the day” was “disquieting to say the least”, and demanded further explanation.

“This confirms all our worst fears,” she told Schools Week. “It is worrying that the government has bowed to pressure from almost everyone in the education community so late in the day.

“The use of terms like ‘hostile environment’ will send shudders through the minds of everyone who hears it. Is this really the sort of language which is being used in Whitehall?”

Under the new agreement, the Home Office is still able to request pupil data, such as home or school address, when it suspects an immigration offence has been committed or when officials have lost contact with an unaccompanied minor.

Data can also be shared on an ad-hoc basis if the Home Office believes there is “significant and imminent physical risk to the child or parent/guardian” or in instances involving national security.

But the documents also state that one of “strategic aim” of the data-sharing is to create a “hostile environment” for those who “seek to benefit from the abuse of immigration control”.

Jen Persson, from the Defend Digital Me campaign group, said the collection of pupil nationality data had “lost all legitimacy”.

“The Home Office can’t continue to grab every child’s personal data under false pretences of the purposes for its collection,” she said. “It’s time to call off the changes in the school census before its next due date on January 19.”

However the DfE has continued issuing statements that the collection of pupil nationality and country of birth data will help improve children’s education.

A spokesperson said: “It will be used to help us better understand how children with, for example, English as an additional language perform in terms of their broader education, and to assess and monitor the scale and impact immigration may be having on the schools sector.”