Gokenin (an immediate vassal of the shogunate) in Kyoto (在京御家人)

The term "gokenin in Kyoto" (zaikyo gokenin) refers to a gokenin (an immediate vassal of the shogunate in the Kamakura and Muromachi through Edo periods) who was permanently stationed in and around Kyoto under jurisdiction of the Kamakura bakufu (Japanese feudal government headed by a shogun). A gokenin in Kyoto is also referred to as zaikyonin. However, they were often excluded from Kyoto obanyaku (a job to guard Kyoto) because the job was a shift work only for a short period of time.

A gokenin in Kyoto in the early days referred mainly to the ones who owned a shoryo (territory) in Saigoku (western part of Japan ([especially Kyushu, but ranging as far east as Kinki]). But there were also gokenin sent from Togoku (the eastern part of Japan, particularly Kanto region). They served under the command of the Kamakura bakufu in principle. However, the right to judge criminal cases used by the bakufu at that time was based on the approval given by the Imperial Court. Therefore, they could not refuse any command given by the Imperial Court which was superior to the bakufu in rank. (For that reason), they also worked as guards, etc. by the commands of the Imperial Court. The Retired Emperor Gotoba took advantage of these circumstances to appoint gokenin in Kyoto to kebiishi (officials with judicial and police powers) or government official (especially one of low to medium rank) to be efu (a palace guard). He often gave shoryo to them or added them in the Hokumen no bushi (the Imperial Palace Guards for the north side) or the Saimen no bushi (the Imperial Palace Guards for the west side) in his own right. The same was true of kyoto-shugo (military governor of Kyoto) who was the representative of the Kamakura bakufu in Kyoto. The kyoto-shugo was chosen from among the pro-bakufu court nobles, except for a certain period of time.
The gokenin in Kyoto began to be strongly influenced by the Imperial Court which was before their eyes, rather than the Kamakura bakufu,
Accordingly, many of them took the side with the Retired Emperor Gotoba in the Jokyu War then lost their power.

As Rokuhara Tandai (an administrative and judicial agency in Rokuhara, Kyoto) was founded after the war, the system of gokenin in Kyoto was reconstructed under its control. The bakufu assigned gokenin in Kyoto who remained loyal to it during the war to keep their position and shoryo, and those who moved to Saigoku after given shoryo there after the war, to Rokuhara Tandai. They came to be engaged in military and security activities under the command of Rokuhara Tandai. They were exempted from duties such as Obanyaku (a job to guard Kyoto) in exchange for being permanently stationed in Kyoto. Later Kagariya (a guardhouse for soldiers placed at street corners in Kyoto and Kamakura during the Kamakura period) were built in Kyoto. Gokenin in Kyoto took charge of maintaining the security of the city as kagariya guards in exchange for receiving a shoryo called kagariya ryosho (a granted estate for kagariya guarding service) as a benefit. Therefore, they came to be also called kagariya gokenin.

But they were also often recruited for such occasions, including the conflicts against some powers such as the Imperial Court, Enryaku-ji Temple and so on, or battles against Akuto (a villain in the medieval times) who became active in Kinai region (the five capital provinces surrounding the ancient capitals of Nara and Kyoto) and Saigoku after the Mongol invasion attempts against Japan,
The burden on the gokenin in Kyoto became heavier and heavier. In addition, miuchibito (private vassals of the tokuso) sent to Rokuhara Tandai came to supervise the gokenin in Kyoto. The confrontation with gokenin in Kyoto who offended it became worse. Most of the samurai who eventually went down with Rokuhara Tandai, in the assault on it by Takauji ASHIKAGA on the eve of the fall of the Kamakura bakufu, were the members of the Hojo clan and miuchibito. Only few gokenin in Kyoto were included among them because many gokenin switched to the Ashikaga side or withdrew from the front after judging the movement of Takauji. Gokenin who survived it were reorganized into hokoshu (a military post in Muromachi Shogunate), etc. under the jurisdiction of the Muromachi bakufu.

Major gokenin in Kyoto in the early days:
Mitsusue IGA
Koreyoshi OUCHI
Korenobu OUCHI
Tomomasa HIRAGA
OE no Chikahiro
MINAMOTO no Yorikane
MINAMOTO no Yorimochi
NAKAHARA no Chikayoshi
NAKAHARA no Suetoki