The title “samurai,” which originally meant “servant” or “those who serve,” came into use during the twelfth century. In the late Heian and Kamakura periods, certain high-status warriors who were servants of the imperial court were accorded the sixth (lowest) court rank and the title of samurai.
Court rank and samurai status gave the warrior a number of privileges not held by commoners (bonge). Farris (1992:339) elaborates on these privileges:
… freedom from interrogation when suspected of a crime, the prerogative to become a retainer of the Shogunate, and the right to use surnames and to wear certain clothes.
Warrior-followers who held no rank or office were not called samurai in the early medieval period.
In the Edo period (1603- 1867) and modern era (post 1867), the term “samurai” came into generic use for members of the Japanese warrior class in the Edo period.
Source: Hall, D. A. (2012). Encyclopedia of Japanese Martial Arts. New York: Kodansha USA.