In India, social classification based on caste has its origin in ancient times. It was transformed by various ruling elites in medieval, early-modern, and modern India, especially in the aftermath of the collapse of the Mughal Empire and the establishment of the British Raj. Caste is traditionally associated with Hinduism, but is more pervasive in extent: an estimated 98% of contemporary Indians, including Hindus, Muslims, Christians, Sikhs, Buddhists, and Jains, identify with a caste.
Beginning in ancient India, the caste system was originally centered around varna, with Brahmins (priests) and, to a lesser extent, Kshatriyas (rulers and warriors) serving as the elite classes, followed by Vaishyas (traders and merchants) and finally Shudras (labourers). Outside of this system are the oppressed, marginalised, and persecuted Dalits (also known as "Untouchables") and Adivasis (tribals). Over time, the system became increasingly rigid, and the emergence of jati led to further entrenchment, introducing thousands of new castes and sub-castes. With the arrival of Islamic rule, caste-like distinctions were formulated in certain Muslim communities, primarily in North India. The British Raj furthered the system, through census classifications and preferential treatment to Christians and people belonging to certain castes. Social unrest during the 1920s led to a change in this policy towards affirmative action.