From old times, there existed Banyaku in charge of guarding institutions related to the Imperial Court such as Eji-joban (serving in Eji [guard] by coming up to Kyoto from a province) in the Ritsuryo system, Oban (guard for the imperial palace of the emperor and retired emperor, and residence of Sekkan-ke [the families which produced the Regent and the Chief Adviser to the Emperor]) in and after the mid Heian period, and so on.
律令制における衛士上番や平安時代中期以後における大番（天皇・上皇の御所や摂関家の邸宅警備）などの朝廷関係機関を警備する番役が古くから存在していた。