The shogunate's hatchet brigadeThe Shinsengumi (新撰組 or 新選組) was a small elite group of swordsmen commissioned by the Tokugawa shogunate in 1863 as a special police force to counter pro-imperial and anti-shogunate subversion in Kyōto. The Shinsengumi, lit. “newly established corps”, was first called Rōshigumi (浪士組), as most of its members were rōnin, masterless samurai recruited in Edo (modern-day Tōkyō) in 1863 and sent to Kyōto to protect the shogun who was visiting the city at that time.
One of its leaders though, Kiyokawa Hachirō (清河八郎, 1830-1863) was recalled to Edo for expressing pro-imperial sentiments. The remaining thirteen members of the Rōshigumi under Serizawa Kamo (芹沢鴨, 1826-1863) became the founding members of the Shinsengumi. Serizawa was murdered in an internal struggle, and Kondō Isami (近藤 勇, 1834-1868) and Hijikata Toshizō (土方歳三, 1835-1869) emerged as the new leaders. Based in Mibu in Kyōto, the Shinsengumi acted under orders from the Kyōto Shugoshoku (京都守護職, Office of Kyōto Protector), a shogunal office in the period from 1862 to 1868, which was held by Matsudaira Katamori of Aizu for most of its existence and served to keep peace in the city.
The group was involved in the famous massacre at the Ikedaya Inn in 1864 and the defence of the Imperial Palace in the Hamaguri Gomon Incident. Even after the Meiji Restoration the Shinsengumi remained loyal to the shōgun, fighting against the Satsuma-Chōshū Alliance in the Boshin War. Hijikata and his men died in the Battle of Hakodate in June 1869 against the imperial forces.