The samurai became very powerful and important near the end of the Edo period (1603-1867) and in the Shinto period. In the Edo period, they were the most important social caste. All samurai had to live in castle towns. The samurais' lords paid them with rice. Some samurai did not have lords. These samurai were called "Rōnin". The "Rōnin" caused some problems for Japan in the early Edo period.