From 1644 to 1911, China was ruled by the Qing, or Ch'ing (pure), or Manchu, dynasty. In the seventeenth century, China was one of the most powerful countries in the world, but that power and success laid the foundation for eventual massive decline, partly due to a massive population explosion. By the early nineteenth century, Manchu stability was beginning to break down under internal and external pressures. Internally, there was massive corruption in the government with blatant cheating on the civil service exams and the purchase of government posts. Local families accumulated state revenues for their own personal profit, and the army and navy disintegrated because of a lack of funding. Dikes along the Yellow river were not repaired, with floods and famine resulting. Wide scale banditry appeared. The external threat took the form of the British. The British ran a negative balance of trade with China at the time, and resented having to pay silver for tea, silk and porcelain (The Chinese had no desire for any available British goods.). To change the balance of trade in Britain's favor, the government allowed the British East India Company to smuggle opium from India (a far stronger variant) into China. BTW, the trade in opium in China was illegal. From the British point-of-view, they now received silver from China instead of sending silver to China. From 1800 to 1839 the opium trade into China went from about 300 tons to about 2700 tons. The Manchu government realized that this was a monetary and social catastrophe. Not only was China losing silver that it could have been spending on dikes and the army, but wealthy Chinese squandered their fortunes, and families were ruined by the drug. It has been estimated that by 1838 maybe one percent of 400 million Chinese were addicts. Qing emperors tried to forbid the traffic. In the 1830s they tried everything to end the opium dens and the trade. In 1839, Lin Zexu (lin Tse-hsu) was sent to Canton to enforce Chinese law. After European merchants failed to cooperate, he blockaded Canton, searched warehouses and destroyed opium. British merchants appealed to their government for help. The British ultimatum to China was to cease the anti-opium measures, or war would result. In 1839, the first Opium War broke out. China suffered a devastating defeat. Several coastal cities were occupied and the Grand Canal, which joined the Yangzi and Yellow Rivers, was captured. China had to sue for peace. By the terms of the 1842 Treaty of Nanking (Nanjing), China ceded the island of Hong Kong to Great Britain, agreed to pay a reparation of $21 million, released Burma, Korea and Vietnam from Chinese control, legalized the opium trade and opened five Chinese cities to foreigners. A second conflict occurred between 1856 and 1858.