<P> Toyotomi Hideyoshi, who became a grand minister in 1586, himself the son of a poor peasant family, created a law that the samurai caste became codified as permanent and hereditary, and that non-samurai were forbidden to carry weapons, thereby ending the social mobility of Japan up until that point, which lasted until the dissolution of the Edo shogunate by the Meiji revolutionaries . </P> <P> It is important to note that the distinction between samurai and non-samurai was so obscure that during the 16th century, most male adults in any social class (even small farmers) belonged to at least one military organization of their own and served in wars before and during Hideyoshi's rule . It can be said that an "all against all" situation continued for a century . </P> <P> The authorized samurai families after the 17th century were those that chose to follow Nobunaga, Hideyoshi and Ieyasu . Large battles occurred during the change between regimes, and a number of defeated samurai were destroyed, went rōnin or were absorbed into the general populace . </P> <P> In 1592, and again in 1597, Toyotomi Hideyoshi, aiming to invade China (唐 入り) through Korea, mobilized an army of 160,000 peasants and samurai and deployed them to Korea . (See Hideyoshi's invasions of Korea, Chōsen - seibatsu (朝鮮 征伐)). Taking advantage of arquebus mastery and extensive wartime experience from the Sengoku period, Japanese samurai armies made major gains in most of Korea . A few of the more famous samurai generals of this war were Katō Kiyomasa, Konishi Yukinaga, and Shimazu Yoshihiro . Katō Kiyomasa advanced to Orangkai territory (present - day Manchuria) bordering Korea to the northeast and crossed the border into Manchuria, but withdrew after retaliatory attacks from the Jurchens there, as it was clear he had outpaced the rest of the Japanese invasion force . Shimazu Yoshihiro led some 7,000 samurai and, despite being heavily outnumbered, defeated a host of allied Ming and Korean forces at the Battle of Sacheon in 1598, near the conclusion of the campaigns . Yoshihiro was feared as Oni - Shimazu ("Shimazu ogre") and his nickname spread across not only Korea but to Ming Dynasty China . </P>

Where did the last samurai come in the national