The Treaty of Nanjing, signed in 1842, ended the First Opium War between the United Kingdom and China. As a result of the treaty, China ceded the territory of Hong Kong to the British Empire.