Even before the shoguns took control over Medieval Japan the samurai’s worked for the daimyo’s (wealthy landowners that had often left the imperial court to seek fortunes of their own)
In 1180-85, the Taira and Minamoto clans fought in the Genpei war. This civil war was one of the first and biggest battles where two different samurai clans fought one another. Minamoto Yoritomo won the battle changing the lifestyle for samurais forever.
After the Genpei war the Kamakura shogunate began which shifted most of the political power in Japan to the samurai. To ensure the shogunate was stable Yoritomo went to great efforts to define the samurai’s privileged status. Samurai’ soon joined the emperor, shoguns and daimyo’s in having power over peasants, artisans and merchants.