The Shinsengumi was a special police force formed in 1863 during the late Edo period in Japan, primarily to protect the Tokugawa shogunate and maintain order amid the political turmoil of the time. Known for their strict code of conduct and distinctive uniforms, they played a crucial role during the Bakumatsu period, standing against anti-shogunate factions and supporting the shogunate's authority as it faced increasing opposition leading to the fall of the Tokugawa regime.