Still, the reaction to the citizenship law has apparently surprised Mr. Modi, who was re-elected by a comfortable margin last May, but he has shown no signs of backing down. He rose to power by vilifying Muslims, a core tenet of Hindu nationalists. When Mr. Modi was chief minister of Gujarat state, thousands of people were killed and tens of thousands were driven from their home in sectarian violence; most victims were Muslims.

This is not the way India was meant to be. The vision of Mohandas Gandhi (who was murdered by a Hindu nationalist) and Jawaharlal Nehru after the partition of British-ruled India into a Muslim-majority Pakistan and a Hindu-majority India was to build the latter into a secular and democratic republic, with civil liberties for citizens of all faiths.

Since he took office in 2014, Mr. Modi has actively worked to change that, even rewriting history books to exclude Muslim rulers — who, among other things, built the Taj Mahal — and changing official place names to Hindu from Muslim. Hindu mobs that lynch Muslims are rarely punished.

The citizenship bill was the first action that linked religion to citizenship, undermining a fundamental tenet of India’s democracy. Some non-Muslim Indian liberals, including members of the once-dominant Congress Party, have joined in the protests. The law has also drawn sharp criticism from human rights groups and governments. The Office of the United Nations High Commissioner for Human Rights called the citizenship bill “fundamentally discriminatory,” and the United States State Department issued a statement urging India to “protect the rights of its religious minorities in keeping with India’s Constitution and democratic values.” Alas, that would be far more credible if the Trump administration was treating undocumented immigrants in keeping with America’s democratic values.

Mr. Modi’s hold on power remains firm, but the protests at home and abroad have demonstrated limits to how far Indians will allow him to go in pursuit of his Hindu-nationalist agenda. The citizenship bill might still be blocked in the Indian Supreme Court, which begins hearings on it in January. But if it is not, all democratic nations need to speak out against a law, and a national policy, that is patently discriminatory and a threat to India’s democracy.