Anti-immigrant hysteria is sweeping the world: it has powered Trump, enabled the Brexit vote and is roiling the politics of continental Europe. And while the damage done by this politics has been well documented in the west, one country rarely discussed in this regard is India. Yet millions are about to be declared stateless in the country on the grounds that either they or their ancestors came over as undocumented migrants from India’s eastern neighbour, Bangladesh.

Currently, the north-eastern state of Assam is updating its National Register of Citizens: a supposed listing of genuine Indian nationals. Anyone who does not find their name on this NRC will be branded an illegal migrant. The NRC released a draft list in 2018 that declared more then 4 million people to be foreigners. The final list is expected on 31 August.

As in other places across the world, Assam is using the fig leaf of migration to target minorities. The NRC is widely seen as a means to harass Assam’s Bengali speakers, who share their ethnic identity with Bangladeshis. This in spite of the fact that there are more than 83 million Bengalis who are Indian citizens and Bengali speakers have lived in Assam as long as any other ethnic group. This ethnic targeting in Assam merges with the prime minister Narendra Modi’s Hindu nationalism. Modi and his party, the BJP, paint a picture of Muslims from Bangladesh swamping India. Sound familiar?

Illegal migration was a key issue in the May general elections, which the BJP swept. While campaigning, the party president even went so far as to call migrants “termites”. This hysteria means that even India’s courts have taken an exceedingly illiberal turn. Rather than act as a check on executive excess, the judiciary has itself pushed the NRC hard, leading a shocked legal commentator to declare: “The supreme court has transformed itself from the protector of the rule of law into an enthusiastic abettor of its daily violation.”

While an exercise that aims to vet each one of Assam’s 30 million citizens is draconian enough, the real devil lies in the detail. The burden of proof under the NRC is so stringent, partisan and arbitrary that the entire exercise seems geared to exclude people rather than any genuine effort to create a roster of Indian citizens. To qualify for the NRC, applicants have to prove that either they or their ancestors lived in Assam before the start of the 1971 Bangladesh liberation war. The cut-off date is in itself a tool of exclusion since atrocities by the Pakistan army had forced millions of refugees to flee to India even as Bangladesh fought to secede.

The NRC’s weaponisation of red tape has resulted in a state-wide hunt for documents. People have scrambled to locate family land records, the name of a grandparent in historical electoral rolls or even family entries in the original NRC, created in 1951. If having to locate family documents from seven decades back to prove that you are a citizen of the country you were born in isn’t Kafkaesque enough, there is also the fact of Assam’s poverty: more than one in four people in the state are completely illiterate. But even if a person cannot read documents, they have to submit them if they want to avoid being stripped of their citizenship.

Moreover, the entire process is underpinned by ethnic bigotry. In fact, the NRC has an explicitly racist classification of “original inhabitants” – which means that the Assamese ethnic majority will be put through a “less strict and vigorous process” of citizenship vetting. The NRC process has resulted in some surreal outcomes. In one case, a father was branded a foreigner in the draft NRC but his son was declared Indian. A six-year-old girl passed the citizenship test but her twin brother was found to be a foreigner. Spelling errors and inconsistencies in documents – common enough given high illiteracy levels – have acted as a significant roadblock. A typo in your grandfather’s documents could mean you lose your citizenship.

The NRC has drawn comparisons to the Rohingya crisis – both being stark examples of states stripping a minority of their citizenship. In fact, like Assam, Myanmar also accuses the Rohingya of being migrants from Bangladesh and refers to the persecuted group as “Bengalis” in order to reinforce that narrative. However, where the two differ is in magnitude. The Rohingya refugees who fled number about three-quarters of a million. The draft NRC published in 2018 excludes more than five times that number.

The world did not pay attention to the decades-long Rohingya conflict, only waking up once they had been ethnically cleansed. The same thing is happening again with the NRC, but this time the population at risk is so much larger.

After Assam, the BJP has promised a citizenship test for all of India’s 1.3 billion residents – part of a plan to make India a Hindu rashtra, nation. The number of Indian Muslims is almost equal the population of Brazil, the sixth most populous country in the world. A nationwide citizenship test would be an unimaginable tragedy, and would plunge India into chaos.

• Shoaib Daniyal covers Indian politics for the news website Scroll.in