Samurai (侍) were the hereditary military nobility and officer caste of medieval and early-modern Japan from the late 12th century to their abolition in 1876. They were the well-paid retainers of the daimyo (the great feudal landholders). They had high prestige and special privileges such as wearing two swords. They cultivated the bushido codes of martial virtues, indifference to pain, and unflinching loyalty, engaging in many local battles. Though they had predecssors in earlier military and administrative officers, the samurai truly emerged during the Kamakura shogunate, ruling from c.1185–1333.