NEW DELHI — More than four million people in India, mostly Muslims, are at risk of being declared foreign migrants as the government pushes a hard-line Hindu nationalist agenda that has challenged the country’s pluralist traditions and aims to redefine what it means to be Indian.

The hunt for migrants is unfolding in Assam, a poor, hilly state near the borders with Myanmar and Bangladesh. Many of the people whose citizenship is now being questioned were born in India and have enjoyed all the rights of citizens, such as voting in elections.

State authorities are rapidly expanding foreigner tribunals and planning to build huge new detention camps. Hundreds of people have been arrested on suspicion of being a foreign migrant — including a Muslim veteran of the Indian Army. Local activists and lawyers say the pain of being left off a preliminary list of citizens and the prospect of being thrown into jail have driven dozens to suicide.

But the governing party of Prime Minister Narendra Modi is not backing down.

Instead, it is vowing to bring this campaign to force people to prove they are citizens to other parts of India, part of a far-reaching Hindu nationalist program fueled by Mr. Modi’s sweeping re-election victory in May and his stratospheric popularity.