"Oryoshi" was a ryoge no kan (official posts outside of the Ritsuryo code) under the Japanese Ritsuryo system (ancient centralized government system based on the Ritsuryo code). It was an official post in charge of police/military affairs.
Oryoshi first appeared in a document in 795 as a person who commanded sakimori (soldiers garrisoned at strategic places in Kyushu) to move. At that time, oryoshi commanded soldiers but did not engaged in actual battles. Before long, however, oryoshi's job gradually changed to be that of a battle director who commanded soldiers.
In principle, the post of oryoshi was concurrently assumed by kokushi (provincial governor) or gunji (localｌ magistrate) who excelled in military art. Oryoshi was mainly engaged in the maintenance of security in a province such as the current local police. In some cases, oryoshi was responsible for the security in a district instead of a province. Further, there were cases where oryoshi was in charge of military affairs in a wide region like Tokai-do Road/Tosan-do Road.
At any rate, as oryoshi's job was based locally, local powerful families were mainly appointed to this post and their private military power made up the main force of oryoshi. FUJIWARA no Hidesato, who defeated TAIRA no Masakado as the oryoshi of Shimotsuke Province, is well-known. It is believed that oryoshi also existed at shoen (manor) and was engaged in the maintenance of security in shoen.