The British government has told almost 40,000 people by text message that they may be illegal immigrants, but officials have admitted that some legal residents were targeted.

"Message from the Home Office. Our records show that you may not have leave to remain in the UK. Please contact us to discuss your case," the message said.

A spokesman for the Home Office, which is responsible for immigration in the UK, said the texts had been sent to 39,100 people between September 2012 and June 2013.

It is more than just incompetence. It is racist stereotyping.

Bobby Chan, immigration case worker

Similar messages were also sent out via email and by post to contact individuals who had no right to be in Britain, he said.

But some were received by legal residents, including the anti-racism campaigner, Suresh Grover, who said he was "absolutely shocked and quite horrified".

"I came here with my parents in 1966, I was born in East Africa and have always had a British passport," he said.

Bobby Chan, an immigration adviser, said he had also received a text despite having lived in Britain since 1973.

"It is more than just incompetence," he told Al Jazeera. "It is the racist stereotyping of the Chinese community."

The Home Office spokesman said the private contractor responsible for the text campaign had acknowledged 14 texts were sent in error, "a tiny, miniscule number".

The opposition Labour party condemned the campaign as a "gimmick" that risked offending and alienating its own citizens.

'Showing them the door'

It recalled a similar Home Office campaign in July in which posters were displayed in London asking: "In the UK illegally? Go home or face arrest."

The posters were criticised as "stupid and offensive" by the business secretary Vince Cable, a Liberal Democrat member of Prime Minister David Cameron's Conservative-led coalition government.

But days after that campaign was launched, British authorities rounded up scores of "immigrant offenders" in a nationwide operation condemned as racist.

The Home Office was widely criticised for the spot-checks of hundreds of people at stations and on streets in areas including London, Durham, Manchester, Wales and Somerset that lead to the arrest of 139 people.

Witnesses said that the spot checks deliberately targeted ethnic minorities and non-white people.

Source: Al Jazeera and agencies