magistrate Lu-Hung built piercing-bamboo to better protect the city. In 1786, the Lin Shuangwen rebellion was an attempt to siege Tsulosan but failed to overcome the defense of the inhabitants. Consequently, on November 3 of the next year, the Qing Emperor conferred the name Kagee (; ) to praise the citizens' loyalty. In the mid-1800s, a custom of annual riotous mass stoning developed in the city. In 1887, a separate Taiwan Province was declared and the island was administratively divided into four prefectures; the city of Kagee belonged to Tainan Prefecture. Japanese rule In 1895, Taiwan was ceded to Japan in the Treaty of Shimonoseki. The 1906 Meishan earthquake devastated the entire city wall except the Eastern Gate. The Japanese authorities reconstructed the city. Industries and trades started to flourish. According to the census taken in 1904, Kagi was the fourth most populous city in Taiwan, with a population of over twenty thousand. The Great Kagi earthquake (later also known as the 1906 Meishan earthquake) struck the city in mid March 1906. In 1907, the construction of Alishan Forest Railway to Mount Ali was begun. In 1920, the city became an autonomous group as , Kagi District, within Tainan Prefecture, which included modern-day Tainan City, Chiayi County and Yunlin County. In 1930, the town was upgraded to an autonomous city under the same prefecture. Republic of China After the handover of Taiwan from Japan to the Republic of China in October 1945, Chiayi City was established as a provincial city of Taiwan Province. The city consisted of 8 districts, which were Bajiang, Beimen, Beizhen, Nanmen, Tungmen, Tungshan, Ximen and Zhuwei Districts. In 1946, the districts was reorganized to 6 districts in which Bajiang and Nanmen were merged to become Xinnan, Beimen and Beizhen were merged to become Xinbei, Tungmen and Tungshan were merged to become Xindong, Ximen and Zhuwei were merged to become Xinxi District and there were 2 addition of districts from Tainan County which were Shuishang and Taibao Districts. Chiayi saw some of the most violent events during the 228 Incident. In early March, local militas surrounded the Shueishang Airport and fought against the KMT military. There were over 300 casualties. On 12 March 1947, negotiators for peace, including Tan Teng-pho and , were arrested after arriving at the airport and were executed on 25 March. The Kuomintang also executed many civilians in Chiayi. On 16 August 1950,