In the 17th century, the Dutch colonized Taiwan but were soon challenged by the Spanish in the north. The Dutch expelled the Spanish in 1642, only to lose control themselves when Ming loyalist Koxinga defeated them in 1662 and established a base on the island. After the Qing dynasty defeated Koxinga's forces in 1683, Taiwan was increasingly absorbed into the Qing Empire.
After losing the First Sino-Japanese War in 1895, the Qing ceded Taiwan and the Penghu islands to the Japanese Empire. Under Japanese rule, Taiwan produced rice and sugar and served as a staging ground for Japan's invasion of Southeast Asia and the Pacific in WWII. The Japanese instituted their school system in Taiwan and many Taiwanese soldiers fought for Japan.