Heinobunri indicates the disarming of the classes pushed forward during the period from the Azuchi-Momoyama through Edo periods except for the samurai (warrior) class. Later, in the process of the Tokugawa family taking control of the national administration, the samurai class and other classes were separated precisely. And it led to establishing the system of the samurai class being put on top of the hierarchy.
In the medieval period of Japan, not only regular samurai who were jito (land steward appointed by the central military government to each of the estates [shoen] into which the countryside was divided), gokenin (an immediate vassal of the shogunate in the Kamakura and Muromachi through Edo periods) and other roto (retainers) but also jizamurai (local samurai [or dogo: local ruling family]), nobushi (unofficial warrior hidden in a forest) and farmers were armed. Samurai originated in the armed farmers in the Ritsuryo period who developed and cultivated their own land. As the farmers took the system in wartime, having younger people of their tenant farmers armed, hei (samurai) and no (farmers) were inseparable or close to a synonym. Also, as the government that was supposed to take the duties of maintaining security had become useless, distributors also had to be armed themselves. Because of this, while the typical example of samurai who originated in farmers were gokenin in the Kamakura bakufu, the representative of samurai who originated in merchants was Masashige KUSUNOKI who is said to have been a distributor and others.
That is, it is better to think that all the classes had been armed until the society was stabilized in Edo period.
Originally, heinobunri started by the necessity of Sengoku daimyo (Japanese territorial lord in the Sengoku period). This means that during the Sengoku period when the battles were conducted continuously, Sengoku daimyo wanted to mobilize their strongest warriors to politically and militarily important places anytime, swiftly and over the long term. However, in the system in the Muromachi period or before where the retainers lived in their territory, it took a long time for daimyo to call out their retainers. Also, as among their retainers, some of them were half warrior half farmer, the local lords had a problem that their retainers would have complaints against mobilization during the busy farming season. Because of this problem, the Ouchi clan and Miyoshi clan were able to move their army to Kyoto and attain the hegemony, but unable to maintain it.
In contrast, if the feudal lords gathered their vassals around their castles and set them as a full-time regular army, they were able to meet the needs mentioned above and to improve soldiers' skillfulness and the quality of arms (notice: in this case the regular army mentioned here is totally different from the one stipulated in the history of military in the Western countries). On the other hand, if the lords gathered their vassals and had them live around the castles, the citizens' armament besides their soldiers would be a threat to the lords. Therefore, the lords banned the citizens' armament, which is heinobunri.
These measures were partly conducted under the powerful daimyo in the Sengoku period. However, as the measures meant to dissolve the classes such as kokujin (local lord) and jizamurai who had had vested interests, it was after the unification of the whole country by Hideyoshi TOYOTOMI that heinobunri was thoroughly accomplished.
Having their vassals move and live around the castles became a big factor for the castles to develop besides rakuichi-rakuza (free markets and open guilds).
As specific policy measures, kenchi (land survey), katanagari (sword hunt) and kaizoku kinshirei (ban on piracy) were conducted. These measures were to clearly define the relation of land holding and to deprive the citizens other than samurai of the right to bear arms. Also, they were to dismantle the pirates' power and separate suigun (navy) samurai from fisher men.
Into the Edo period, the policy measures were further strengthened. The social class in Japan was precisely divided into four classes, putting the samurai at the top as the ruling class and farmers, craftsmen, and merchants into lower classes in order to put them under the samurai class. In principal, the citizens were not allowed to change their social status, but in the mid Edo period and later this system began to collapse again.