The military-nobility caste known as samurai — roughly meaning “those who serve” — emerged in medieval Japan as provincial warriors, and rose to control the country in the 12th century.

As the enforcement arm of the ruling shogunate, the samurai were elevated to a position of privilege.

Samurai followed a code of honor called bushido, informed by Confucianism and Zen Buddhism. Bushido emphasized martial fearlessness, discipline and loyalty, as well as general kindness.

These photos, made in the years after Japan finally opened its ports to international trade, capture samurai in their final days. With the 1868 Meiji Restoration and the end of feudalism, carrying swords was prohibited to all but the new national armed forces.

The samurai class was dissolved, but bushido survived as the national moral code of the new Japan.