The Treaty of Nanjing, signed in 1842, ended the first Opium War. The war, fought between Britain and China, resulted in the Qing dynasty losing power and the British gaining more power in their trade relationship with China. The war was fought over Britain's illegal importation of opium from India into China, which had disastrous effects for China's economy and society. Britain won this won and was able to gain more privileges in their trade with China.
As a result of the treaty, Britain gained the territory of Hong Kong, and their trade expanded from one port city (Canton) to five treaty ports. Shanghai was one of the new ports that was opened to British trade, and it quickly became an international center of trade. In addition, Britain was able to try its citizens who were accused of crimes in their own courts, and Britain gained most favored nation status (meaning that they had any rights that were granted to other foreign countries). The treaty began the process of China's loss of power to foreign nations, including France and the United States, both of whom soon demanded and received the same trading privileges as Britain had.