Political archrivals in India's most populous state have stitched an inventive political alliance that fuses votes from the ancient caste system to take on the ruling Hindu nationalist party-led government.

The low-caste-dominated Bahujan Samaj Party and Samajwadi Party, which holds sway among a section of so-called "backward" castes and Muslims, have decided to contest elections in vote-rich Uttar Pradesh state in a rainbow coalition headed by BSP President Mayawati.

The first test of this alliance takes place Sunday in Saharanpur, where Mayawati and SP President Akhilesh Yadav will hold their first election event, rallying support to defeat Prime Minister Narendra Modi's ruling Bharatiya Janata Party.

In Uttar Pradesh, lower-caste people are 22% of the population, "backward" people are 45%, and 19% are Muslims. The remaining 14% are upper caste.