 After the establishment of the Tokugawa shogunate, Niwa Nagashige was transferred from Tanagura Domain to become "daimyō" of the newly created 100,000 "koku" Shirakawa Domain in 1627 and completely rebuilt and expanded Komine Castle between 1628 and 1632.During the remainder of the Edo period, the castle passed through the hands of seven "daimyō" clans with a total of 21 "daimyō" (the Niwa, Sakaibara, Honda, three branches of the Matsudaira clan and finally the Abe clan) before reverting to direct control of the Tokugawa shogunate in 1866, on the eve of the Boshin War.During this period the most famous ruler of Shirakawa was Matsudaira Sadanobu (1759-1829).