The Qing government had spent years trying to stop the opium trade prior to the British meddling. Finally becoming fed up, the Qing government dispatched commisioner Lin Zexu to Guangzhou to suppress illicit opium traffic. Lin seized illegal stocks of opium owned by Chinese dealers and then detained the entire foreign community and confiscated and destroyed some 20,000 chests of illicit British opium. The British retaliated with a punitive expedition, thus initiating the first Anglo-Chinese war, better known as the Opium War .
The British began by seizing Hong Kong in August 1839. In 1840 an expeditionary force of 15 barracks ships, 4 steam-powered gunboats and 25 smaller boats with 4000 marines blockaded the mouth of the Pearl River. 1841 saw the British capture the Bogue Forts and 1842 saw the occupation of Shanghai.
The Chinese were thoroughly unprepared for the war though and had no idea of the capabilities of the British war machine. It was a lopsided war with the British the easy victors. The result of the Opium War was the Treaty of Nanjing in which China ceded Hong Kong to the British, abolished the licensed monopoly system of trade, opened 5 ports to British residence and foreign trade, limited the tariff on trade to 5% ad valorem, granted British nationals exemption from Chinese laws and paid a large indemnity.
In addition, Britain was to have most favored-nation treatment, that is, it would receive whatever trading concessions the Chinese granted other powers then or later. The Treaty of Nanjing set the scope and character of an unequal relationship for the ensuing century of what the Chinese would call "national humiliations."