Politicians from both houses of India's parliament have cast their ballots to elect the country's next president, with two candidates from the lowest rank of the Hindu caste system - Dalits - vying for the largely ceremonial post.

The candidate from the ruling BJP, Ram Nath Kovind, a 71-year-old lawyer turned politician who was until recently governor of the eastern state of Bihar, is predicted to win.

Kovind is also backed by several regional parties.

His main rival is Meira Kumar, 72, who was India's first female speaker of the parliament and a former federal minister. She is backed by the main opposition Congress party.

OPINION: Can caste be banned from Indian politics?

The new president - India's 14th - will take over from Pranab Mukherjee, a veteran Congress politician, who completes his five-year term on July 24.

The day-long polling was being held simultaneously in the national and state capitals, according to India's Election Commission.

The votes will be counted on July 20.

Narendra Modi, India's prime minister, was among the first to cast his vote at a booth in Parliament.

"The presidential poll this time is historic. Probably for the first time no party has made any undignified or unwarranted comment on the rival candidate," Modi said on Twitter on the eve of the poll.

"Every political party has kept in mind the dignity of this election."

Against the odds

Sonia Gandhi, the Congress party leader, acknowledged on Sunday that the odds were stacked against the opposition's candidate.

The president is chosen by an electoral college of two houses of parliament and state assemblies.

The BJP has an over two-thirds majority in the Lok Sabha, or lower house of parliament, and runs governments by itself or in alliance with other parties in 17 of India's 29 states.

READ MORE: India court bans religion, caste in election campaigns

The winner of Monday's contest will be India's second president belonging to the Dalit community, after KR Narayanan, who was president between 1997-2002.

Dalits, formerly known as "untouchables", are on the lowest rank of India's traditional social system based on caste.

India's president is the head of the state, but executive powers are vested in the prime minister.

The president, however, has an important role to play when elections produce hung parliaments, state governments are dissolved and during other political crises.