Karatsu domain was founded in 1593, by Terazawa Hirotaka, who was granted lordship of Karatsu and landholdings of 83,000 koku. He was also Nagasaki bugyō under the Tokugawa bakufu. The Terazawa clan took part in the Battle of Sekigahara on the side of Tokugawa Ieyasu and received an additional 40,000 koku of land, bringing the total revenues of the domain up to 123,000 koku. The Terazawa took part in the Shogunate's expedition to suppress the Shimabara Uprising. The family held on to Karatsu until 1647, when Hirotaka's son Katataka committed suicide; due to a lack of heir, the family came to an end and the domain was confiscated by the central government. Several families were rotated through Karatsu for the next century: two generations of the Ōkubo clan; three generations of the Ogyū-Matsudaira clan, four generations of the Doi clan, and four of the Mizuno clan, including the famous reformer Mizuno Tadakuni. The domain then passed into the hands of Ogasawara Nagamasa, whose family remained until Karatsu domain was abolished in 1871. During the Boshin War of the Meiji Restoration of 1868-69, Ogasawara Nagamichi, the de facto ruler of Karatsu, led a group of his retainers on the side of the Ōuetsu Reppan Dōmei; after the fall of this alliance he went to Ezo and fought under the forces of the Ezo Republic. At the same time, Karatsu's domain-based administration was forced to pledge military support to the Satchō Alliance of Emperor Meiji. Ogasawara Naganari, the Meiji period Imperial Japanese Navy admiral, was a descendant of the Ogasawara branch which ruled Karatsu.. How many years after the Karatsu domain was founded did the family hold on to it until?