The Ming Dynasty ruled China from 1369. The Ming Dynasty ruled China effectively with able administrators. They instituted civil service exams, which ensured an effective bureaucracy. The Mings also managed to bring peace to their northern borders and strengthened the Great Wall. The Ming began the exploration of the Indian Ocean with large ocean-going junks. Palace intrigue, however, forced the end to exploration. Finally, the Mings went so extreme as to outlaw all sea exploration. In 1514 the Portuguese arrived in China; their behavior outraged the Chinese, who called them "ocean devils" and expelled them from Canton, agreeing to occupy a tiny sliver of land called Macao.
By the end of the 16th century, the Ming administration began to decline. Foreign trade began to disrupt the Chinese economy. In the 1630s, a significant epidemic devastated China. A peasant revolt then broke out led by Li Zicheng. In 1644 Li occupied Beijing, and the last Ming emperor committed suicide. The Manchus who lived north of the Great Wall in that period, Manchuria, took this opportunity to invade. All of China rapidly fell to the Manchus, who ruthlessly imposed their customs on the Chinese. Slowly, however, the Manchus adapted to the Chinese system. The Manchus had two great monarchs, Kangxi, who ruled from 1661 to 1722 (61 years), and Qianlong, who ruled from 1736 to 1795. The Manchus emperors during this period were excellent administrators and ruled China effectively. By the end of the 18th century, the Manchu rule began to decline. Foreign governments began to demand trading rights that the Manchus resisted.
The Chinese had a large trade surplus with the British, who did not have enough goods to sell to China to meet British demands for Chinese goods. The British solution- sell the Chinese opium. The Chinese demanded that the British stop on moral grounds. The British refused, so the Chinese blockaded the British trading area in Canton, demanding the opium. This resulted in the Opium Wars that lasted from 1839-to 1842. The British won and demanded an opening of five Chinese cities to trade. China agreed and also ceded to Britain the Island of Hong Kong in perpetuity. In the 1850s China was torn apart by the Taiping revolt. The fourteen-year struggle resulted in the death of as many as 14 million people. In 1894 the Chinese lost a war with Japan over Korea. By the turn of the century, all the great powers were competing for control over parts of China.