New laws will give the Home Office the power to snoop on the personal data of millions of people for “immigration control”, campaigners are warning.

A little-noticed clause smuggled into data protection legislation creates an exemption to privacy rights for immigration investigations.

The civil rights group Liberty has condemned the threat of “two-tier, racially discriminatory” rules – demanding that Parliament overturn the move.

Without a fightback, millions of migrants could have their personal information “corrected or erased” without knowing “who is processing their data, which data is being processed and why”, it warned.

And the exemption is so broad that it could affect “volunteers running night shelters or food banks, or British citizens trying to access health services or education”.

Liberty suggested it had been inserted to allow the Home Office to more closely monitor EU nationals granted residency rights after Brexit.

Martha Spurrier, the group’s director, said: “Even from a Government with a track record of fostering division and sanctioning discrimination, this is a particularly brazen expression of how low they will go to bring border control into our everyday lives, no matter the cost.

“The Government can’t be allowed to sneak this nakedly racist provision onto our law books. We urge the Lords to take it out of the bill.”

And Satbir Singh, the chief executive of the Joint Council for the Welfare of Immigrants, said: “Why should migrants be denied the right to have their information processed lawfully, fairly and transparently?

“Bank accounts can be frozen, people can be denied healthcare or a place to live based on errors that will never be corrected.”

A previous attempt to link data privacy to immigration control was defeated in the 1983 after a similar outcry, the groups pointed out.

The clause, in the Data Protection Bill, appears to be the latest attempt to step up what Theresa May, as Home Secretary, promised would be a “hostile environment” for migrants.

The NHS is required to release information about people suspected of breaking immigration rules, allowing thousands of people to be trace every year.

And there was uproar when it was revealed that schools are recording every pupil’s country of birth, turning school administrators into “border guards”, it was claimed.

The Department for Education passed on details of 1,500 children a month for immigration enforcement, before the Home Office was forced to end the arrangement.

It was also revealed that Ms May in 2015 wanted to use data from immigration checks to penalise children living in the country illegally in school admissions decisions, but was blocked.

Arrangements also exist between the Home Office and the Department for Work and Pensions and HM Revenue & Customs, Liberty said, but are shrouded in secrecy.

The Government has boasted that the bill will make data protection laws “fit for the digital age” and “empower people to take control of their data”.

But paragraph 4 schedule 2 removes privacy rights for “the maintenance of effective immigration control” or “the investigation or detection of activities that would interfere with effective immigration control”.

A Government spokesman said making data rules “fit for the digital age” involved “ensuring we support our criminal justice agencies and national security organisations”.