The samurai were military class warriors who protected the people of japan. They protected their daimyo leaders there shogan and the contributing peasants. if a peasant was disrespectful to the samurai or his daimyo than the samurai had permission to execute him.
the samurai were powerful but they had to follow the bushido code of honor also known as the samurai code. the bushido code was the code that kept the samurai honorable . if they did not follow the code they would sometimes commit suicide to restore honor to their daimyo.
woman could also be samurai as male samurais were away a lot of the time the woman would often train to protect their house/land.