One of family names in Japan.
Due to the Taika Reforms, the ritsuryo system was officially introduced in Japan, and the local system was also organized. Around 649, the 'Kuni' (an administrative unit) administrated by local Gozoku (powerful local clans), i.e., Kuninomiyatsuko (provincial governors), was abolished, and Kori/Hyo (local administrative organization) was implemented. Old Kuninomiyatsuko were assigned to be Chihokan (local officials) called Kori no miyatsuko and Kori no kami (district chieftains).
(A district or provincial administration that emerged in the realm of Great King Kotoku)
Later, due to Taiho Ritsuryo (Taiho Code) edited in 701, Kori/Ryo was abolished, and Gun (administrative district) was implemented and was administrated by Shitokan (four classifications of bureaucrats' ranks) as Gunji: Dairyo (first-ranked Gunji), Shoryo (second-ranked Gunji), Shusei (third-ranked Gunji) and Shucho (fourth-ranked Gunji in charge of drafting and accepting documents). Dairyo and Shoryo who especially had high authorities were also called, 'Gunryo' (hereditary district magistrates). Unlike Kokushi who was appointed from the central government officials with a fixed term, Gunji was appointed from local Gozoku including old Kuninomiyatsuko by heredity and was a lifelong official without a fixed term. Moreover, according to the court ranking law of the Yoro ritsuryo code (code promulgated in the Yoro period), Gunji is not included in Kanisoto (the ranks of the bureaucracy of the ritsuryo system), and also it is clearly mentioned in Kushiki-ryo (the Ritsuryo law) (Article 52) that Gunji is not Shikijikan (a person with an official rank). Gunji was a special position which was based on the Ritsuryo law but was not included in the government organization of the ritsuryo system.
Gunji not only had the right to collect taxes, but also had great authority to be in charge of: saving the taxes, paying taxes as tribute and using them, as well as controlling Handen Shuju (a regulation of land ownership). The local administration at the beginning of the ritsuryo system was a two-tiered administration by Kokushi sent by the Imperial Court and by Gunji having authorities as a local chief. However, the Imperial Court started restructuring Gun by dividing them and introducing Go (village) in order to create Gun as administrative units detached from the influence of Gozoku. Moreover, when there were multiple Gozoku in a Gun, each Gozoku was assigned to be Gunji in turn so that one specific Gozoku would not monopolize the position of Gunji.
Gunji under the ritsuryo system
Shikibu-sho (Ministry of Ceremonial) exercised jurisdiction over the appointment and dismissal of Gunji. A Gunji candidate recommended by Kokushi had to visit Shikibu-sho to have an interview before being appointed. Not everyone recommended by Kokushi was assigned to be Gunji, and this decision was made depending on the situation of the area. Although the most important factor in assigning Gunji, according to the ritsuryo system, was personal ability, it was the record and line of clan and family of the candidate, called Fudai (hereditary) that was actually prioritized. Kokushi was able to assign a temporary Gunji (called Ginin Gunji [literally, a quasi-appointed district manager]) until an official Gunji was assigned. When an official Gunji was appointed, Ginin Gunji naturally lost their position, but Kokushi in some provinces were later given authority to increase the number of Gunji temporarily, and those temporary Gunji were also called Ginin Gunji.
Socially, Gunji had traditional authority as well as enormous financial power, and maintained the order of local societies by relieving poor peasants as "influential local Gozoku." Politically, they were more like "local officials under Kokushi" and their position was lower than Kokushi, however, since they were practically in charge of local administration including the tax collection and the execution of the punishment of minor criminals, it is recognized that the central government maintained the local ruling through Gunji who kept track of the local societies.
Gunji conducted government affairs at a public office called Gunga (provincial office), but sometimes a private residence of Gozoku who were assigned to be Gunji was used as Gunga. Such Gunga was sometimes called Guke/Gunge/Kooge.
Gunji had a lot of privileges such as receiving Shikiden (office-rice fields), sending their children to Kokugaku (provincial schools) and allowing them to be Kondei (regular soldiers guarding Kokubu [ancient provincial offices] or Sekisho [checking station]). Gunji received more Shikiden than Kokushi: Dairyo received 6-cho, Shoryo received 4-cho, Shusei and Shucho each received 2-cho ("cho" means measure in length of approximately 109 meters.), but they did not receive any stipend nor Jikifu (a vassal household allotted to courtier, shrines and temples).
Elimination of Gunji
Due to the stalemate of the ritsuryo system, a practical administrative reform was implemented around the middle of the 9th century. Also, in the provinces, the authority of Kokushi was enforced in order for the Imperial Court to ensure the tax revenue. Accordingly, the authority of Gunji was gradually absorbed by the authority of Kokushi. Kokushi became in charge of Shoso (warehouse) in each Gun, and deprived Gunji of the right to collect taxes as well as the authority over the suiko (government loans, often seed rice, made to peasants in Japan from the 7th through 12th centuries) which had been the Gunji's major source of income. As a result, local Gozoku who had been serving as Gunji were required to change. On the other hand, Zaichokanjin (the local officials in the Heian and Kamakura periods) or executive local government officials, who had the authority of Kokushi, became influential rapidly. Some local Gozoku avoided the position of Gunji, and chose to survive as Zaichokanjin instead. Along with the reduction of Gunji authority, Gunga and Guke were diminished. Moreover, the ancient-style Gun, Go and Shoen (manor in medieval Japan) were dissolved or reformed, and the medieval-style Gun, Go and Shoen were established. Also, Gozoku of Old Gunji started running Myoden (rice field lots in charge of a nominal holder), and became Tato (cultivators). Gunji as local officials became in name only, however, there appeared some cases that samurai inherited from Gozoku who had produced Gunji took 'Gunji' as their name, and also in some area, Gunji survived meagerly as one of the Shiki system (stratified land ruling structure).