The real threat of Taiwan being pared off by Japan, the U.S. or a European power helped finally turn Beijing's attention to island affairs in the 1870s. The military beefed up coastal defenses, installed and maintained strategic pathways (including Batongguan, 八通關越嶺道), and raised lighthouses to bolster China's claim to active sovereignty and give potential occupiers pause for thought before committing troops. Attention to the island spiked again after the Sino-French War (1883-85), when the island was granted provincial status (Taiwan had previously been governed as part of Fujian Province). The capital was moved from sunny Tainan to soggy Taipei and one of the Empire's first commercial rail lines was installed to link the deepwater port of Keelung to Taipei (Banka, 艋舺) and Hsinchu.
In the end, it was all a case of too little, too late. The island's status as a relatively recent acquisition, its physical separation from the Chinese Mainland, its proximity to Japan and the disintegration of central authority across much of China made Taiwan too tempting a prize in the aftermath of a war fought far to the north.
The First Sino-Japanese War (1894-1895)
In the closing years of the 19th century, Northeast Asia's crumbling status quo pushed Korea, ancient vassal and ally of China, to the center of regional rivalries. Japan wanted control of the strategically positioned peninsula and saw in either a collapse or rejuvenation of China the inevitable transformation of Korea into a forward base for unfriendly powers. On the one hand, China's collapse could very well consign the peninsula to Russia, Japan's main strategic rival in Northeast Asia. On the other, China's rejuvenation would surely reinforce the prejudices of Confucian Korea against Japan - a nation "slavishly" adopting alien Western values. Japan initiated hostilities to pull the kingdom, preemptively, into its political orbit.
Albeit brief and decisively one-sided, the First Sino-Japanese War (甲午戰爭) holds claim to several "firsts". It was the first modern conflict between Asian powers and the first time the latest in maritime weaponry – the ironclad battleship – had a central role in combat. It was also Japan's first test as an ascendant power in the Pacific.
The war represented a calamitous setback to China's efforts to limit to a handful of coastal districts foreign influence in her country. Ten years later, much of eastern China was open to trade and travel; Beijing had been sacked by an army of eight allied countries; and foreign powers had taken formal control of five new enclaves along China's seaboard as well as prime real estate in the northeast.
Positioned on the southern flank of the Ryukyu Islands (琉球, Loo-Choo Islands [see map here], which Japan had annexed less than two decades before), Taiwan was coveted by expansion-minded Japanese as both a protective buffer for the home islands and a projection of imperial ambitions in Asia. China, its imperial capital exposed and Northern Fleet at the bottom of the Yellow Sea, could offer little resistance to Japan's peace terms, which, among other demands, included the surrender of Taiwan and the Penghu (Pescadore) Islands. The Treaty of Shimonoseki was ratified on 8 May 1895, and China left Taiwan to its fate under Japanese occupation. The handover ceremony, originally scheduled to take place in Taipei, was actually convened in choppy waters off Bitoujiao (Punto San Diego) – Qing officials fearing reprisals from Taiwanese loyalists should the ceremony take place on land.
Largely unaware of the scale of their country's military defeat; sure of the difficulties Japan would have in occupying Taiwan; and hopeful that Japan's European rivals might step up to the island's defense, local Qing officials (to the apparent annoyance of the imperial court) and prominent Taiwanese made a hasty declaration of Taiwan independence -- 15 days after Treaty ratification and 6 days prior to the arrival of Japan's occupation force. Likely reflecting the sentiments of the island's ethnic Chinese majority, which had not previously contemplated separation from China, the president of the newly declared Republic of Formosa (台灣民主國), Tang Jingsong (唐景崧), professed the island's continuing loyalty to the Qing throne and subordinacy to China as a tributary state.