After the Genpei war of the late 12th century, a clan leader Minamoto no Yoritomo obtained the right to appoint shugo and jito, and was allowed to organize soldiers and police, and to collect a certain amount of tax. Initially, their responsibility was restricted to arresting rebels and collecting needed army provisions, and they were forbidden from interfering with Kokushi Governors, but their responsibility gradually expanded and thus the samurai-class appeared as the political ruling power in Japan. Minamoto no Yoritomo opened the Kamakura Bakufu Shogunate in 1192.
When was the Genpei war?
late 12th century