With no warfare since the early 17th century, samurai gradually lost their military function during the Tokugawa era (also called the Edo period).
When had samurai last been used in battle?
the early 17th century