Parents are being urged to boycott requests to disclose their child’s nationality and country of birth over fears it could turn teachers into de facto border guards and stoke divisions in the classroom.

Human rights groups are concerned that the data, collected for the first time this year from pupils aged two to 19 as part of the schools census, could be used against children and their families by immigration enforcement.

The Department for Education (DfE) insists that the information will not be handed to the Home Office and that the data is being collected and input to the national pupil database (NPD) to ensure children “receive the best possible education”.

However, disclosures under freedom of information laws have shown that the Home Office has been handed NPD data on 18 occasions since 2012, while police requests for information from the dataset were granted 31 times.

Disclosure is not compulsory, but a recent investigation by the trade magazine Schools Week found that schools were misinterpreting official guidance by demanding pupils’ passport numbers and even specifically targeting the parents of non-white children.

“That creates a climate where half the class is being told you’ve got to bring in your passport and the other half haven’t,” said Gracie Mae Bradley, from Against Borders for Children. “In a post-Brexit environment, kids are already precarious; they are already feeling like it’s not a good thing to be a migrant child and this further divides them.”

She called on parents to boycott the census questions. “If every parent in the country exercised that right to refuse, that would protect all undocumented children from any potential enforcement action and it also sends a very strong signal about the kind of society that we want to live in.”

On Monday, more than 20 groups are writing to the education secretary, Justine Greening, to ask her to reverse the requirement for schools to collect the data, warning that the plan risked violating the right to privacy of children and families.

“Our grave concern is that the new data will be shared with the Home Office and therefore used for immigration enforcement purposes,” says the letter, whose signatories include Liberty, the Migrants’ Rights Network and Privacy International.

“We have already seen data-sharing between the Home Office and other departments increase since the government announced its commitment to creating a ‘hostile environment’ for undocumented migrants. Such measures deter vulnerable children and families from accessing essential services, exercising their human rights and participating on an equal basis in our communities.”

Campaigners see the new census requirement as the latest step in a crackdown on what the government has dubbed “education tourism”. In 2013, ministers were forced to abandon proposals to exclude the children of undocumented migrants from school, amid fears it would breach international human rights law.

But two years later, Nicky Morgan, then education secretary, ordered officials to investigate how much of a “pull factor” state schools were for immigrants, as part of measures to slash net migration. “And then, in 2016, you get this announcement about monitoring the scale and impact of pupil migration on the education sector,” Bradley said.

Bella Sankey, policy director of Liberty, the human rights group, said the latest plan risked creating “a chilling effect around school attendance”.

“Hostile-environment policies are deeply problematic,” she said. “They outsource immigration enforcement to private citizens and public sector workers whose roles have nothing to do with border control. This latest wave of reforms targets sensitive public services like healthcare and education. It is insidious to be targeting the kids and risks making them additionally vulnerable if they are then kept away from school.”

Don Flynn, director of the Migrants’ Rights Network, said the proposal jeopardised “a decade of real advance” in the relationships between schools and migrant communities. He said: “People in migrant communities across the UK have been thrown into great uncertainty about their future as a result of the Brexit vote and the harsher tone of the public debate.

“The DfE should not be adding to this anxiety by introducing a measure which will inevitably increase the sense of being watched and scrutinised by state agencies with a view to future deportations.”

The DfE insisted it took the privacy of children seriously and that the data would be used for research purposes and not be routinely published. A spokesperson said: “These data items will not be passed to the Home Office. They are solely for internal Department for Education use for analysis, statistics and research.

“This information 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.”