A tradition in cities of politely refusing to rent homes to Muslims has now morphed into an active movement of othering them in schools and public places. The police rarely intervene in cases of mob violence or hate speech and the courts fail to deliver justice. While the mainstream media is largely compliant, independent news sites, universities, students and civil society activists are being harassed.

Mr. Gandhi has attempted to counter this with a combination of tactics. He has been in campaign mode for months, deftly uses social media to amplify messages, and is espousing a politics of unity, hope and inclusiveness. He tackles questions on policy seriously, has interests in the interplay of technology and society, emphasizes the importance of public institutions and generally draws a distinction between Mr. Modi’s certitude and his own willingness to learn.

He has also made striking policy proposals as well that are likely to resonate with the poor. Mr. Gandhi has announced a minimum income guarantee that will transfer $87 every month to the poorest 20 percent of the population, targeting about 50 million families. The proposed scheme, which has generated a fair bit of interest, is expected by economists to be funded by “reducing the existing subsidies that primarily go to the rich and middle classes.”

The Congress party’s manifesto promises to extend a popular public works program to 150 days a year, increase spending on education and health care to 6 and 3 percent of the G.D.P. and review the use of draconian security legislation.

Mr. Gandhi is hoping that a combination offering social peace as a public good, a return to constitutionalism, a surge in institution-building and a strong social democratic policy focus will be enough to upset Mr. Modi. It is an approach that appeals to Indians who are now tired of the violent energies unleashed by Hindu nationalism.

Critics have mixed feelings about Mr. Gandhi’s party. They have long argued that there is scarcely a pathology in India’s political life that does not have its origins in years of Congress rule. But even they now recognize the value of leaders like Mr. Gandhi, who reaffirm constitutional values and practice a form of politics that seeks to represent all groups — a marked contrast to the Hindu nationalist B.J.P., which aims to handle the demands of India’s diversity by forging a Hindu vote while ignoring the claims of minorities on the state.

Mr. Gandhi faces several challenges. He has to convince skeptics that he is a genuine break from the Congress party’s past. He has to constantly curate a language of support to marginal groups that the Hindu nationalists cannot exploit — and has shifted from silence on anti-Muslim violence in the past to being more indignant about it recently.