Kingdom of Tungning

The Kingdom of Tungning, also known as Tywan by the English at the time, was a dynastic maritime state that ruled part of southwestern Taiwan and the Penghu islands between 1661 and 1683. It is the first predominantly ethnic Han state in Taiwanese history. At its zenith, the kingdom's maritime power dominated varying extents of coastal regions of southeastern China and controlled the major sea lanes across both China Seas, and its vast trade network stretched from Japan to Southeast Asia.

The kingdom was founded by Koxinga (Zheng Chenggong) after seizing control of Taiwan from Dutch rule. Zheng hoped to restore the Ming dynasty in Mainland China, when the Ming remnants' rump state in southern China was progressively conquered by the Manchu-led Qing dynasty. The Zheng dynasty used the island of Taiwan as a military base for their Ming loyalist movement which aimed to reclaim mainland China from the Qing. Under Zheng rule, Taiwan underwent a process of sinicization in an effort to consolidate the last stronghold of Han Chinese resistance against the invading Manchus. Until its annexation by the Qing dynasty in 1683, the kingdom was ruled by Koxinga's heirs, the House of Koxinga, and the period of rule is sometimes referred to as the Koxinga dynasty or the Zheng dynasty.

Names
In reference to its reigning house of Koxinga, the Kingdom of Tungning is sometimes known as the Zheng dynasty, Zheng clan Kingdom or Yanping Kingdom , named after Koxinga's hereditary title of "Prince of Yanping"  that bestowed by the Yongli emperor of the South Ming.

Taiwan was initially referred to by Koxinga as Tungtu (, literally "eastern capital"). In 1664, his son and successor Zheng Jing renamed it Tungning (, literally "Eastern Pacification"). This name change reflects Jing's intention to permanently settle his dominion in Taiwan rather than an unattainable hope of making Taiwan a temporary capital in the East to receive Yongli Emperor, who was executed by the Qing forces two years earlier.

In Britain, it was known as Tywan (Taiwan),   named after the King's residence at the city of "Tywan" in present-day Tainan. The period of rule is sometimes referred to as the Koxinga dynasty.

Ming-Qing war
The Kingdom of Tungning started out as a Ming dynasty loyalist movement led by Zheng Chenggong, known in Dutch sources as Koxinga, the son of former pirate turned general, Zheng Zhilong. After reconciling with the Ming government, Zhilong moved his headquarters from Taiwan to Fujian. Although he did not sever ties with the 30,000 Fujianese he had previously helped settle in Taiwan with Ming approval, his move eased the passage for Dutch domination over Taiwan. Zhilong then controlled a large portion of Fujian, managing trade and collecting taxes in both Xiamen and Taiwan. By 1640, Zhilong had become military commander of Fujian Province. Chenggong spent the first seven years of his life in Japan with his mother, Tagawa Matsu, and then went to school in Fujian, obtaining a county-level licentiate at the age of 15. Afterwards he left for Nanjing to study at the Imperial Academy.

On mainland China, the Manchu-led Qing dynasty forces broke through Shanhai Pass in 1644 and rapidly overwhelmed the Ming. After Beijing fell in 1644 to rebels, Chenggong and his followers declared their loyalty to the Ming dynasty and he was bestowed the title Guoxingye, or Lord of the Imperial surname, pronounced "Kok seng ia" in southern Fujianese, from which Koxinga is derived. His father Zhilong aided the Longwu Emperor in a military expedition in 1646, but Longwu was captured and executed. The Qing offered several high-ranking Ming officials and military leaders positions in exchange for cessation of resistance activities. In November 1646, Zhilong declared his loyalty to the Qing and lived out the rest of his life under house arrest in Beijing.

Zheng Chenggong continued the resistance against the Qing from Xiamen, which was named "Memorial Prefecture for the Ming" in 1654. In 1649, Chenggong gained control over Quanzhou but then lost it. Further attacks further afield resulted in even less success. In 1650 he planned a major northward offensive from Guangdong in conjunction with a Ming loyalist in Guangxi. The Qing deployed a large army to the area and Chenggong decided to take his chances by ferrying his army along the coast but a storm hindered his movements. The Qing launched a surprise attack on Xiamen, forcing him to return to protect it. From 1656 to 1658 he planned to take Nanjing. In the summer of 1658 he completed his preparations and set sail with his fleet but a storm turned him back. On July 7, 1659, Chenggong's fleet set sail again and his army encircled Nanjing on 24 August. Qing reinforcements arrived and broke Chenggong's army, forcing them to retreat to Xiamen with many of the veterans and thousands of soldiers killed or captured. In 1660 the Qing embarked on a coastal evacuation policy to starve Chenggong of his source of livelihood.

Trade war with the Dutch
Zheng had cordial relations with the Dutch East India Company (VOC) during most of the 1640s and early 1650s. However some of the rebels during the Guo Huaiyi rebellion had expected Zheng to come to their aid. Some company officials believed that the rebellion had been incited by Zheng. A Jesuit priest told the Dutch that Zheng was looking at Taiwan as a new base of operations. In 1654, he sent a letter to Taiwan to have a Dutch surgeon sent to Xiamen for medical assistance. In the spring of 1655 no silk junks arrived in Taiwan. Company officials suspected that this was caused by the Ming-Qing war but others felt it was a deliberate plan by Zheng to cause them harm. The company sent a junk to Penghu to see whether Zheng was preparing forces there but they found nothing. Defenses at Fort Zeelandia were strengthened. According to European and Chinese traders, Zheng had 300,000 men and 3,000 junks. In 1655, the governor of Taiwan received a letter from Zheng insulting the Dutch, calling them "more like animals than Christians," and referring to the Chinese in Taiwan as his subjects. He commanded them to stop trading with the Spanish. Zheng sent a letter directly to the Chinese leaders in Taiwan, rather than Dutch authorities, stating that he would withhold his junks from trading in Taiwan if the Dutch would not guarantee his junks safety from Dutch depredations in Southeast Asia. To raise funds for his war effort, Zheng had increased foreign trade by sending junks to Japan, Tonkin, Cambodia, Palembang, and Malaka. Batavia was wary of this competition and wrote that this would "undermine our profits." Batavia sent a small fleet to Southeast Asian ports to intercept Zheng’s junks. One junk was captured and its cargo of peppers confiscated but another junk managed to escape. The Dutch realized this would be received badly by Zheng and thus offered an alliance with the Manchus in Beijing, however nothing came of the negotiations.

The Taiwanese trade slowed and for several months in late 1655 and early 1656 not a single Chinese vessel arrived in Tayouan. Even low-cost goods grew scarce and as demand for them rose, the value of aboriginal products fell. Chinese merchants in Taiwan suffered because they could not take their products to China to sell. The system of selling Chinese merchants the right to trade in aboriginal villages fell apart as did many of the other revenue systems supporting the company's profits. On 9 July 1656, a junk flying Zheng’s flag arrived at Fort Zeelandia. It carried an edict instructed to be handed over to the Chinese leaders of Taiwan. Zheng wrote that he was angry with the Dutch but since Chinese people lived in Taiwan, he would allow them to trade on the Chinese coast for 100 days so long as only Taiwanese products were sold. The Dutch confiscated the letter but the damage had been done. Chinese merchants who depended on trade of foreign wares began leaving with their families. Zheng made good on his edict and confiscated a Chinese junk from Tayouan trading pepper in Xiamen, causing Chinese merchants to abort their trade voyages. A Chinese official arrived in Tayouan carrying a document with Zheng’s seal demanding to inspect all the junks in Tayouan and their cargoes. It referred to the Chinese in Taiwan as his subjects. Chinese merchants refused to buy the company's foreign wares and even sold their own foreign wares, causing prices to collapse. Soon, Tayouan was devoid of junks.

The embargo imposed by Zheng hurt the company's profits by ending the import of gold, which was the main item used to exchange for company goods in India. Chinese merchants in aboriginal villages ran out of goods to trade for aboriginal products. Chinese farmers also suffered due to the exodus of Chinese from Taiwan. They could not export their rice and sugar and their investments in fields and labor came to nothing. By the end of 1656, Chinese farmers were asking for relief from debts to the company and even requested help in the form of guaranteed prices for their goods. Many Chinese could barely find food for themselves while students in mission schools ran short of Chinese paper. Some company officials believed the embargo was a prelude to an invasion while others thought it was to obtain favorable trading privileges with the company. The Chinese mostly thought it was due to Dutch depredations on Zheng’s junks and that the embargo would not last much longer since it also hurt Zheng’s profits. The Chinese sent presents and a letter to Zheng urging him to reopen trade to Taiwan but no reply was received. The Dutch also sent letters to Zheng through a Chinese intermediary named He Tingbin.

Conquest of Taiwan


A man working for the VOC named He Bin fled to Zheng Chenggong's base in Xiamen and provided him with a map of Taiwan. On 23 March 1661, Zheng's forces set sail from Kinmen (Quemoy) with a large fleet of 400 ships carrying around 25,000 soldiers and sailors aboard. They arrived at Penghu the next day and on 30 March, a small garrison was left at Penghu while the main body of the fleet arrived at Tayouan on 2 April. Zheng's forces routed 240 Dutch soldiers at Baxemboy Island in the Bay of Taiwan. They landed at the bay of Luermen. Three Dutch ships attacked the Chinese junks and destroyed several until their main warship, the Hector, exploded due to a cannon firing near its gunpowder supply. The remaining two ships consisted of a yacht and a lesser warship, which were unable to keep Zheng from controlling the waters around Taiwan. The landing forces defeated the Dutch.

On 4 April, Fort Provintia surrendered to the Zheng forces. On 7 April, Zheng's army surrounded Fort Zeelandia and bombarded the fort with 28 cannons. An assault on the fort failed and many of Zheng's best soldiers died, after which Zheng decided to starve out the defenders. On 28 May, news of the siege reached Jakarta, and the company dispatched a fleet of 12 ships and 700 sailors to relieve the fort. The reinforcements met with bad weather and a shipwreck that had an entire crew captured by natives and sent to the Zheng camp. Fighting between the Dutch and Zheng ships lasted from July to October when the Dutch ultimately failed to relieve the siege after losing several ships. They retreated with two ships sunk, three smaller ships captured, and 130 casualties. In January 1662, a German sergeant named Hans Jurgen Radis defected and informed the Zheng forces of a weakness in the fort's defenses. On 12 January, Zheng's ships initiated a bombardment while the land forces prepared to assault. The Dutch surrendered. Frederick Coyett, the Dutch governor, negotiated a treaty, where the Dutch surrendered the fortress and left all the goods and property of the Company behind. In return, most Dutch officials, soldiers and civilians were allowed to leave with their personal belongings and supplies and return to Batavia (present-day Jakarta, Indonesia), ending 38 years of Dutch colonial rule on Taiwan. Zheng did, however, detain some Dutch "women, children, and priests" as prisoners. On 9 February the remaining company personnel in Fort Zeelandia left Taiwan. Zheng then proceeded on a tour of inspection to "see with his own eyes the extent and condition of his new domain."

The Taiwanese aboriginal tribes who were previously allied with the Dutch against the Chinese during the Guo Huaiyi rebellion in 1652 turned against the Dutch during the siege and defected to Zheng's Chinese forces. The aboriginals of Sincan defected to Zheng after he offered them amnesty. The Sincan aboriginals then proceeded to work for the Chinese and behead Dutch people in executions. The frontier aboriginals in the mountains and plains also surrendered and defected to the Chinese on 17 May 1661, celebrating their freedom from compulsory education under the Dutch rule by hunting down Dutch people and beheading them and trashing their Christian school textbooks.

In April 1662, Zheng sent a message to Manila demanding annual tribute. Sabiniano Manrique de Lara, the Spanish Governor-General of the Philippines, rejected the request and strengthened defenses in anticipation of an attack. The non-Christian Chinese population was dispersed. Zheng declared his intention to conquer the Philippines in retaliation for the Spanish mistreatment of the Chinese settlers there, which was also the reason he used for attacking Dutch Taiwan. Tensions eased after Zheng Chenggong died on 23 June, four months after the end of the siege of Fort Zeelandia. It is uncertain how he died and causes range from malaria to pneumonia to dysentery. One version of events say he died in a fit of madness when his officers refused his orders to execute his son, Zheng Jing, who had an affair with his wet nurse and conceived a child with her. Zheng became a legendary figure in folk tales and his image as a Ming loyalist was honored even by the Kangxi Emperor of the Qing dynasty, who removed his name from the "sea banditry" category and labelled him a valiant loyalist to a deposed dynasty. Chinese nationalists in the 20th century invoked Zheng Chenggong for his patriotism and political loyalty against Qing and foreign influence.

Dutch ships continued to come into conflict with Zheng forces in the 17th century and in 1663, the Dutch officially became allies of the Qing dynasty against the Zheng forces. The Dutch looted a Buddhist complex on the Zhoushan islands in 1665 and slaughtered its monks. The Dutch held out at Keelung until 1668 when their presence became untenable due to hostile natives and withdrew from Taiwan completely. The Zheng navy executed 34 Dutch sailors and drowned eight Dutch sailors after ambushing, looting and sinking the Dutch fluyt ship Cuylenburg in 1672 off of northeastern Taiwan. Twenty one Dutch sailors escaped to Japan. The ship was going from Nagasaki to Batavia on a trade mission.

Permanent settlement


Realizing that defeating the Qing would not happen in the short term, Zheng Chenggong began transforming Taiwan into a temporary but practical seat of power for the Southern Ming loyalist movement. Chenggong instituted a Ming-style administration that was the first Chinese government in Taiwan. This system of government was modeled on the Six Ministries: civil service, revenue, rites, war, punishment, and public works. Great care was taken in the use of symbolism to appeal to Ming legitimacy, an example being the use of the term guan instead of bu to name departments, since the latter is reserved for the central government, whereas Taiwan was to be a regional office of the rightful Ming rule of China. Chenggong renamed Fort Zeelandia to Anping and Provintia to Chikan. The town surrounding Chikan came to be known as Chengtian. On 29 May 1662, Chikan was renamed to "Ming Eastern Capital" (Dongdu Mingjing). Later "Eastern Capital" (Dongdu) was renamed to Dongning (Wades Giles: Tungning), which means "Eastern Pacification," by Zheng Jing, the son of Chenggong. One prefecture and two counties (Tianxing and Wannian) were established in Taiwan.

Zheng Jing was a devout anti-Qing Confucian and his rule in Taiwan has been described as an attempt to sinicize Taiwan and naturalize Han Chinese customs. He had a very rigid understanding of what was "Chinese" and "barbarian". He had a hatred of Manchus. In 1657 he had a Chinese Christian seized and threatened to execute him because he wore his hair in the Manchu style. Zheng and his ministers often held banquets reminiscing about the fall of the Ming dynasty. According to Zheng, the suicide of the Chongzhen Emperor was "a most miserable plight, alas, unseen since antiquity!" Zheng blamed the incompetence of the Ming loyalists on the mainland in resisting the Manchus. He referred to the Manchus in derogatory terms and accused them of perverse religious customs such as incest.

Zheng Jing dutifully complied with the prescribed procedures for Ming officials by regularly presenting reports and paying tribute to the absent Ming emperor. Zheng Jing never relinquished the trappings of a Ming government such as the use of the Yongli calendar and drew on this claim for legitimacy. He treated the deceased Yongli Emperor as though he were still alive and paid homage to him on the Lunar New Year. This enabled him to enlist the support of Ming loyalists who helped him establish an administration in Taiwan. Civil officials were instated with statuses theoretically equal to their military counterparts. However oversight of all affairs were given to Chen Yonghua, the Advisory Staff Officers, and Feng Xifan, head of the Imperial Bodyguard. Zheng Jing's family members and officers remained at the top of the organizational hierarchy. They enacted programs of farm development, house and temple construction, and Confucian education. Aside from agricultural development, Zheng Jing advised commoners to replace their grass huts with houses made of wood and baked tiles. He ordered temples worshiping the Buddha and local Fujianese deities to be constructed. An Imperial Academy and Confucian Shrine were established in 1665 and 1666. A regular civil service examination system was implemented for selecting talent to manage Taiwanese affairs. Chinese language schools for both the Chinese and indigenous populations were opened to break Dutch and indigenous influences. Chinese cultural hegemony was promoted in concert with territorial expansion to the south and east.

According to the poet Shen Guangwen, Zheng Jing disbanded the troops and turned them into military colonies. Shen and other literati abandoned Zheng Jing once they realized he lacked the ability to retake the mainland and was permanently settling in Taiwan. According to one of Shen's poems, he often looked to the west for good news from the mainland but had to flee north out of fear of alienation from the group. Zheng Jing justified the new direction by saying that in thirty years, Taiwan would be able to compete with the Central Plains. This was not entirely unfounded. According to a 1665 inscription by the poet Wang Zhongxiao: "Once the Imperial Surname [Zheng Chenggong] governed this land, the Chinese people came one after another. In Anping of Dongning, I only see and hear Chinese. The people here are people of the Middle Kingdom, and the soil is the soil of the Middle Kingdom." In later negotiations with the Qing, Zheng Jing described himself as the ruler of the Kingdom of Dongning. He boasted that he had nothing to envy about the Central Lands and that many barbarians paid obeisance to him. Zheng Jing agreed to relations with the Qing based on a model such as Korea, that was functionally independent, but the Qing refused his offer.

Agriculture
The most immediate problem facing Zheng forces after the successful invasion of Taiwan was a severe shortage of food. It is estimated that prior to the Zheng invasion, the population of Taiwan was no greater than 100,000. The initial Zheng army, their family, and retainers that settled in Taiwan is estimated to be 30,000 at minimum. According to a 1668 memorial to the Qing court, Shi Lang claimed that there were 20,000 to 30,000 Han Chinese in Taiwan under the Dutch. Zheng Chenggong brought with him another 30,000 soldiers and their families while Zheng Jing brought another 6,000 to 7,000 to Taiwan. Most of the soldiers became farmers. Half of them did not have wives or families.

To address the food shortage, Zheng Chenggong instituted a tuntian (military farm) policy in which soldiers worked as farmers when not assigned to active duty in a guard battalion. No effort was spared to ensure the successful implementation of this policy to develop Taiwan into a self-sufficient island, and a series of land and taxation policies were established to encourage the expansion and cultivation of fertile lands for increased food production capabilities. Lands held by the Dutch were immediately reclaimed and ownership distributed amongst Zheng's trusted staff and relatives to be rented out to peasant farmers, whilst properly developing other farmlands in the south. To encourage expansion into new farmlands, a policy of varying taxation was implemented wherein fertile land newly claimed for the Zheng regime would be taxed at a much lower rate than those reclaimed from the Dutch, considered "official land".

According to Xing Hang, Zheng Jing dispatched teachers to various indigenous tribes to provide them with animals, tools, and know how on advanced and intensive farming techniques - severely punishing those that refused. Schools were set up to teach the aboriginal people the Chinese language. Extensive farming spread Han Chinese settlements to the southern tip of the island and as far north as modern Hsinchu, often at the expense of aboriginal tribes. Several rebellions flared up over the course of Zheng rule due to Han Chinese incursions on indigenous ways of life. In one pacification campaign, Liu Guoxuan, stationed in modern Changhua County, killed several hundred Shalu tribes people in modern Taichung, leaving only six alive. The competing Kingdom of Middag was gradually weakened. A series of major conflicts with the Saisiyat people left the Saisiyat decimated and with much of their land under Zheng rule. The details of the conflicts remain uncertain however historians agree that the outcome was negative for the Saisiyat.

Chen Yonghua is credited with the introduction of new agricultural techniques such as water-storage for annual dry periods, the deliberate cultivation of sugarcane as a cash crop for trade with the Europeans, and the cooperative unit machinery for mass refining of sugar. The island became more economically self-sufficient with Chen's introduction of mass salt drying by evaporation, creating much higher quality salt than by rock deposits which were found to be very rare in Taiwan.

By 1666, grain harvests were able to keep soldiers and civilians well nourished while sugarcane plantations proved profitable. By the start of 1684, a year after the end of Zheng rule, areas under cultivation in Taiwan had reached 43,699.7 hectares, more than triple the figure of 12,500 hectares by the end of the Dutch era in 1660.

Trade
The Zheng merchant fleets continued to operate between Japan and Southeast Asian countries, reaping profits as a center of trade. Private traders paid Zheng authorities a gift, or tributary tax, for safe passage through the Taiwan Strait. Zheng Taiwan held a monopoly on certain commodities such as sugarcane and deer skin, extracted from the aboriginals through a quota tribute system, which sold at a high price in Japan. Unlike the Dutch East India Company, under which almost 90 percent of levies were related to commercial activities, there was greater emphasis on the rapid production of grains such as rice and yam to meet basic subsistence needs. Levies under Zheng governance were fixed and led to a decrease in commercial potential and lower incremental revenues. However the Zheng economy achieved greater economic diversification than the profit-driven Dutch colony and cultivated more types of grain, vegetables, fruits, and seafood. By the end of Zheng rule in 1683, the government was extracting an annual income of 4,033 kg of silver in Taiwan, more than a 30 percent increase from the 3,145.9 kg under the Dutch in 1655. Sugar exports reached 1,194,000 kg a year, exceeding the peak of 1,032,810 kg under the Dutch in 1658. Output of deerskin remained the same.

Retreat to Taiwan
Following the death of Zheng Chenggong in 1662, his son Zheng Jing's succession was met with dissension in Taiwan, where the leaders made Zheng Miao, Zheng Chenggong's fifth son, the successor. With the support of Xiamen's commanders, Zheng Jing arrived in Taiwan in December 1662 and defeated his political enemies. The political infighting caused some followers to become disillusioned and defect to the Qing. From September 1661 to August 1662, some 290 officers, 4,334 soldiers, and 467 civilians left Zheng Taiwan. Three leading Zheng commanders contacted Qing authorities with the intention to defect but Zheng Jing imprisoned them. The defections continued and by 1663, some 3,985 officials and officers, 40,962 soldiers, 64,230 civilians, and 900 ships in Fujian had defected from Zheng held territory. To combat population decline, Zheng Jing also promoted migration to Taiwan. Between 1665 and 1669 a large number of Fujianese moved to Taiwan under Zheng rule. In a few years, some 9,000 Chinese were brought to Taiwan by Zheng Jing.

The Qing dynasty enacted a sea-ban on coastal China to starve out the Zheng forces. In 1663, the writer Xia Lin who lived in Xiamen testified that the Zhengs were short on supplies and the people suffered tremendous hardship due to the Qing sea ban (haijin) policy. After Zheng forces retreated completely from the coast of Fujian in 1669, the Qing started relaxing restrictions on maritime trade. Due to the sea ban policy, which saw the relocation of all southern coastal towns and ports that had been subject to Zheng raids, migration occurred from these areas to Taiwan. About 1,000 previous Ming government officials moved to Taiwan fleeing Qing persecution.

From June to August 1663, Duke Huang Wu of Haicheng and commander Shi Lang of Tongan urged the Qing court to take Xiamen, and made plans for an attack in October. The Dutch too had attacked Zheng ships in Xiamen but failed to take the town. In August the Dutch contacted Qing authorities in Fujian to propose a joint expedition against Zheng Taiwan. The message did not reach the Qing court until 7 January 1663 and it took another four months for a reply. The Kangxi Emperor granted the Dutch permission to set up inland trading posts but declined the proposal for a joint expedition. The Dutch did however assist the Qing in naval combat against the Zheng fleet in October 1663, resulting in the capture of Zheng bases in Xiamen and Kinmen in November. The Zheng admiral Zhou Quanbin surrendered on 20 November. The remaining Zheng forces fled southward and completely evacuated from the mainland coast in the spring of 1664.

Qing-Dutch forces attempted to invade Taiwan twice in December 1664. On both occasions Admiral Shi Lang turned back his ships due to adverse weather. Shi Lang tried to attack Taiwan again in 1666 but turned back due to a storm. The Dutch continued to attack Zheng ships from time to time, disrupting trade, and occupied Keelung until 1668, but they were unable to take back the island. Their position at sea was gradually taken over by Great Britain. On 10 September 1670, a representative from the British East India Company signed a trade agreement with Zheng Taiwan. However trade with the British was limited because of the Zheng monopoly on sugar cane and deer hide as well as the inability of the British to match the price of East Asian goods for resale. Zheng trade was subject to the Qing sea ban policy throughout its existence, limiting trade with mainland China to smugglers.

Peace negotiations
After Zheng Jing's forces were ejected from the mainland, the Qing tried to win over Zheng through negotiation. In 1667 letters were sent to Zheng Taiwan to negotiate their surrender. Zheng Jing declined the offer. Zheng emphasized that Taiwan had never been part of China and that he wished to establish relations with the Qing based on a model similar to a foreign country. However the Ming loyalist Zha Jizu noted in 1669 that Zheng Jing continued to use the defunct Ming dynasty's calendar. He never gave up on aspirations for power on the mainland and later attacked the Qing dynasty during the Revolt of the Three Feudatories, taking settlements on the coast.

General Kong Yuanzhang, who had defected to the Qing, personally visited Zheng Jing in Taiwan in November 1667. He returned in December with nothing but reports of gracious treatment and gifts of precious items. In 1669 the Qing offered the Zhengs significant autonomy in Taiwan if they shaved their heads and wore their hair in the Manchu style. Zheng Jing declined and insisted on a relationship with the Qing similar to Korea. After the military conflict with Zheng during the Three Feudatories revolt, the Kangxi Emperor made clear that he considered all the southern Fujianese living in Taiwan to be Chinese, unlike the Koreans, and that they must shave their heads.

Revolt of the Three Feudatories
In 1670 and 1673, Zheng forces seized tributary vessels on their way to the mainland from Ryukyu. In 1671, Zheng forces raided the coast of Zhejiang and Fujian. In 1674, Zheng Jing took advantage of the Revolt of the Three Feudatories on the mainland and recaptured Xiamen and used it as a trading center to fund his efforts to retake mainland China. He imported swords, gun barrels, knives, armours, lead and saltpeter, and other components for gunpowder. Zheng made an alliance with the rebel lord Geng Jingzhong in Fujian, but they fell afoul of each other not long afterward. Zheng captured Quanzhou and Zhangzhou in 1674. In 1675, the commander of Chaozhou, Liu Jingzhong, defected to Zheng. After Geng and other rebels surrendered to the Qing in 1676 and 1677, the tide turned against the Zheng forces. Quanzhou was lost to the Qing on 12 March 1677 and then Zhangzhou and Haicheng on 5 April. Zheng forces counterattacked and retook Haicheng in August. Zheng naval forces blockaded Quanzhou and tried to retake the city in August 1678 but they were forced to retreat in October when Qing reinforcements arrived. Zheng forces suffered heavy casualties in a battle in January 1679.

On 6 March 1680, the Qing fleet led by Admiral Wan Zhengse moved against Zheng naval forces near Quanzhou and defeated them on 20 March with assistance from land-based artillery. The sudden retreat of Zheng naval forces caused widespread panic on land and many Zheng commanders and soldiers defected to the Qing. Xiamen was abandoned. On 10 April, Zheng Jing's war on the mainland came to a close.

Zheng Jing died in early 1681.

Shi Lang
Admiral Shi Lang was the primary leader in advocating and organizing the Qing effort to conquer Zheng Taiwan. He was born in Jinjiang, Fujian in 1621 and became a soldier in the service of Zheng Zhilong at the age of 17. Shi served with distinction until he had a falling out with Zheng Chenggong. He quarreled with another commander, Chen Bin, and Chenggong took Chen's side. Shi also disagreed with Chenggong on strategic matters. Shi threatened to leave and become a monk, which annoyed Chenggong. Chenggong eventually imprisoned Shi for criticizing his behavior, which Shi described as being no different than that of a pirate. A relative of Shi's falsified orders from Chenggong to take Shi out for interrogation and he seized the opportunity to escape. Shi tried to seek mediation with Chenggong but his efforts failed and instead Chenggong sent an assassin after him. The assassination attempt failed. Chenggong executed Shi's father and brother in 1651, resulting in Shi's defection to the Qing.

Shi was assigned to follow Geng Jimao and pacify Ming loyalists in Guangdong and Guangxi before returning to Fujian in 1655. Shi was assigned to an assault force on a Zheng stronghold at the suggestion of another commander, Huang Wu, who had also defected from the Zheng side. The successful attack saw the surrender of Chen Bin and execution of 500 Zheng captives. In 1658, Shi was made Deputy Commander of Tongan. He continued to participate in campaigns against the Zhengs. Shi passed on information such as Zheng internal conflict between Chenggong and his son onto Beijing.

The Qing established a naval force in Fujian in 1662 and appointed Shi Lang as the commander. Huang and Shi advocated for more aggressive action against the Zhengs besides just a coastal evacuation policy. On 15 May 1663, Shi attacked the Zheng fleet and succeeded in capturing 24 Zheng officers, 5 ships, and killing over 200 enemies. Shi planned to attack Xiamen on 19 September, but the Qing court decided to postpone the assault until Dutch naval reinforcements arrived. From 18 to 20 November, the Dutch fought sea battles against the Zheng while Shi took Xiamen. In 1664, Shi assembled a fleet of 240 ships, and in conjunction with 16,500 troops, chased remaining Zheng forces south. They failed to dislodge the last Zheng stronghold due to the departure of the Dutch fleet. However, after the defection of Zheng commander Zhou Quanbin, Zheng Jing decided to pull out from the remaining mainland stronghold in the spring of 1664.

Shi was not content with just the defeat of Zheng forces on the mainland. He proposed to the Qing court an invasion of Penghu and Taiwan. In November 1664, Shi's fleet set sail but was turned back by a storm. He tried again in May 1665 but there was too little wind to move the ships and then a few days later the winds reversed direction and forced him to return. Another failed attempt was made in June when they were met with a violent storm, sinking a few small ships, and damaging the masts of several other ships. Shi's flagship was blown to the coast of Guangdong on 30 June. In 1666, the Qing called off the expedition.

Preparations
Shi Lang was instructed to arrange the necessary ships, escorts, and provisions for a peace mission to Taiwan, but he did not believe Zheng Jing would accept the Qing's terms. He delivered a memorial to Beijing on 7 January 1668 and warned that if the Zhengs built up their strength, they would pose a serious danger. Shi detailed his plans to invade Taiwan with just 20,000 men and 170 battle ships. He required 10 new battle ships and 20 troop transports to be constructed. He argued that by securing Taiwan, the numerous garrisons along the coastline would be rendered unnecessary and reduce the defense spending.

After Kong Yuanzhang returned from his failed peace mission to Taiwan in 1667, he accused Shi of collusion with Zheng Jing. Shi was recalled from Fujian and his officers and soldiers were relocated to hinterland provinces. Some of them defected back to the Zhengs. The Fujian Naval Command was abrogated and Shi was given a leisurely post as one of the emperor's six grand guardsmen. Shi was not the only one who proposed more aggressive action against Taiwan. On 14 August 1668, Zhejiang official Shi Weiqi recommended imposing an economic blockade on Taiwan, which the Qing rejected.

The Fujian Naval Command was revived under Wang Zhiding on 9 January 1679 but Wang quit the job a few months later and admitted he was not suitable for the position. Wan Zhengse, who defected from the Zhengs in 1663, was appointed to replace Wang in May. Wan was opposed to an invasion of Taiwan and was adamant that such an attempt would end in failure. Wan's lack of confidence upset the Kangxi Emperor. In 1681, the Neo-Confucian scholar Li Guangdi recommended Shi Lang to be the coordinator of the invasion force. Shi was reappointed as the naval chief of Fujian on 10 September 1681. He assumed his duty in Xiamen on 15 November at the age of 61.

Admiral Shi's plan was to take Penghu first and then use it as a base to launch further operations. If the Zhengs did not surrender, Penghu would be used as a base for a Qing invasion into Taiwan. The Governor-general Yao Qisheng disagreed with Shi's plan to take Penghu first and proposed a two pronged attack on Tamsui and Penghu at the same time. Shi thought the proposal was unrealistic and requested to be put in total control over the entire invasion force. Kangxi denied the request.

In Taiwan, Zheng Jing's death resulted in a coup shortly afterward. His illegitimate son, Zheng Keshuang, murdered his brother Zheng Kezang with the support of minister Feng Xifan. Political turmoil, heavy taxes, an epidemic in the north, a large fire that caused the destruction of more than a thousand houses, and suspicion of collusion with the Qing caused more Zheng followers to defect to the Qing. Zheng's deputy Commander Liu Bingzhong surrendered with his ships and men from Penghu.

Qing invasion
Orders from the Kangxi Emperor to invade Taiwan reached Yao Qisheng and Shi Lang on 6 June 1682. The invasion fleet was met with unfavorable winds and was forced to turn back. Yao proposed a five-month postponement of the invasion to wait for favorable winds in November. Conflict between Yao and Shi led to Yao's removal from power in November.

On 18 November 1682, Shi Lang was authorized to assume the role of supreme commander while Yao was relegated to logistical matters. Supplies arrived for Shi's 21,000 troops, 70 large warships, 103 supply ships, and 65 double mast vessels in early December. Spy ships were sent to scout Penghu and returned safely. Two attempts to sail to Penghu in February 1683 failed due to a shift in winds.

Shi's fleet of 238 ships and over 21,000 men set sail on 8 July 1683. Liu Guoxuan, the commander of 30,000 men at Penghu, considered the movement a false alarm and believed Shi would turn back. The next day, Shi's fleet was sighted at small islands to the northwest of Penghu. The Qing forces were met by 200 Zheng ships. Following an exchange of gunfire, the Qing were forced to retreat with two Zheng naval commanders, Qiu Hui and Jiang Sheng, in pursuit. The Qing vanguard led by Admiral Lan Li provided cover fire for a withdrawal. Shi was hit in the right eye and Lan was wounded in the stomach during the fighting. The Zheng side also suffered heavy losses, making Liu reluctant to pursue the disarrayed Qing forces. He reported a "great victory" back to Taiwan.

On 11 July, Shi regrouped his squadrons and requested reinforcements at Bazhao. On 16 July, a reinforcement of large ships arrived. Shi divided the main striking force into eight squadrons of seven ships with himself leading from the middle. Two flotillas of 50 small ships sailed in two different directions as a diversion. The remaining vessels served as rear reinforcements.

The battle took place in the bay of Magong. The Zheng garrison fired at the Qing ships and then set sail from the harbor with about 100 ships to meet the Qing forces. Shi concentrated fire on one big enemy ship at a time until all of Zheng's battle ships were sunk by the end of 17 July. Liu escaped to Taiwan with dozens of small vessels. Approximately 12,000 Zheng men perished. The garrison commanders surrendered after hearing of Liu's escape. The Qing captured Penghu on 18 July.

Surrender
General He You, the chief commander of northern Taiwan, contacted Shi Lang with the intention of surrendering. Dong Teng, the commander of a Zheng fleet, followed suit. After his defeat at Penghu, Liu Guoxuan favored surrendering and convinced the Zheng government to send a peace mission to Penghu. On 26 August 1683, the 13-year old ruler Zheng Keshuang asked Zheng Dexiao to draft a petition of surrender. The first petition was rejected for its insistence on allowing Zheng Keshuang to stay in Taiwan. The second petition of surrender, bearing terms of unconditional surrender, arrived at Penghu on 5 September.

Shi Lang's party arrived in Taiwan on 5 October 1683 to supervise the surrender. No one was executed and the surrender went smoothly. Zheng Keshuang and other leaders shaved their heads in the Manchu style. Some Ming loyalists refused and chose death rather than to cut their hair but the majority accepted this change. The use of the Ming calendar, which the Zhengs had upheld for 38 years, was ended. A three-year tax exemption for all local inhabitants was proclaimed.

Zheng Keshuang was taken to Beijing, where he was ennobled by the Qing emperor as Duke of Hanjun (漢軍公); together with his family and leading officers, he was also inducted into the Eight Banners military system. Junior members of the House of Zheng acquired the hereditary style of Sia (舍). The Qing sent the 17 Ming princes still living on Taiwan back to mainland China where they spent the rest of their lives.