A social classification system called varnashrama emerged during the Later Vedic period, as a means to order and regulate society. The system created four main castes based on hereditary occupation - the Brahmins (poets, priests, teachers, scholars), the Kshatriyas (kings, warriors, and nobility), the Vaishyas (agriculturists, and merchants), and Shudras (artisans, service providers and laborers).
The varnashramas were enforced through a rigid code of conduct specific to each class, based on the dharmashastras (law books) of the later Vedic period. An ancient code of conduct (Smriti) defines brahminhood - "By birth, every man is a Shudra (an ignorant person). Through various types of disciplines (samskaras), he becomes a dwija (twice born). Through the studies of scriptures, he becomes a vipra (or a scholar). Through realization of supreme spirit (brahmajnana), he becomes a brahmin."
The belief that to be a brahmin priest and teacher, one has to be born in a brahmin family, is a much later concept in Ancient India. Although the Hindu caste system is unique in the world, in some ways it resembles Plato's ideal society of philosophers, warriors and commoners.