Taiwan has been inhabited for thousands of years, but the first known settlers probably came from South East Asia rather than China.
The island first appears in Chinese records in AD239, when China sent an expeditionary force to explore - a fact Beijing uses to back its territorial claim.
But thereafter, consecutive Chinese rulers paid little attention to Taiwan, sometimes outlawing emigration there, and sometimes describing it as a base for pirates.
After a brief spell as a Dutch colony (1642-1661) and then under the control of pirate's son Cheng Ch'eng-kung, Taiwan was unquestionably administered by China's Qing dynasty from 1683 to 1895. But the quality of government was poor, there were frequent uprisings, and officials did little to improve the growing population's daily lives.
Starting at the beginning of the 17th century, significant numbers of migrants started arriving from China, often fleeing turmoil or hardship. Most were Hoklo Chinese from Fujian (Fukien) province or were Hakka Chinese, largely from Guangdong. The descendants of these two migrations now make up by far the largest population group.
In 1895, following war between Japan and China, Taiwan was given to Japan in perpetuity as reward for its victory. Tokyo quickly developed its new colony's economy, lifting agricultural output and laying the foundations of Taiwan's later, rapid growth.
But Japan's defeat in World War II brought further upheaval.
The US and Britain had agreed that Taiwan should be handed over to their ally, Chiang Kai-shek's Republic of China government, which was then in control of most of China. But in the next few years, Chiang's troops were beaten back by the Communist armies under Mao Zedong.
Chiang and the remnants of his Kuomintang (KMT) government fled to Taiwan in 1949. This group, referred to as Mainland Chinese and then making up 1.5m people, dominated Taiwan's politics for many years, even though they only account for 14% of the population.
Having inherited an effective dictatorship, Chiang's son, Chiang Ching-kuo, began a process of democratisation, which eventually led to the 2000 election of the island's first non-KMT president, Chen Shui-bian.