PBS "Japan: Memoirs of an Secret Empire" explains that samurai were an elite caste of warriors and administrators in Japan during the medieval period and following Shogunate era. Originally recruited on a local level from all levels of society, samurai eventually became the closest feudal Japan ever came to a national army and civil service. Samurai ethics were informed by Zen Buddhism and a native warrior code, known as Bushido.
Beginning in the 10th century, Japanese warrior culture formed around the ideals of loyal service to the feudal lord, bravery and an unflinching sense of personal and family honor. In time, these tenets formed the core of the samurai ethos and guided the civil administration of Japan for nearly 900 years, until the mid-1870s, according to PBS "Japan: Memoirs of an Secret Empire."
At first, nearly any able-bodied fighting man was permitted to earn a place in the ranks of the samurai. Near the end of the 16th century, however, a series of edicts from the Shogun Toyotomi Hideyoshi began to formalize samurai as a social rank that could only be entered by birth or marriage. At this time, common people in Japan were forbidden the possession or use of weapons; and, the holders of samurai rank were vested with the power to administer justice in their realms subject only to the will of their lord. The samurai declined during the Meiji Period, and they were eventually abolished by the end of the 19th century.