NEW DELHI — India’s Supreme Court ruled on Monday that candidates for political office cannot appeal to voters on the basis of religion, caste, community or language, arguing that India’s Constitution enshrines its elections as fundamentally secular.

A majority of four justices ruled that elections won on religious- or caste-based appeals by candidates or their proxies could be declared null and void.

Three justices, in a dissent, argued that such topics were constitutionally protected free speech.

The ruling came as India prepared for a wave of assembly elections in seven states, seen as an important test of the strength of Prime Minister Narendra Modi’s Bharatiya Janata Party.

It also called into question an essential characteristic of Indian politics, whose secular nature often seems skin-deep.