Hong Kong was handed back to China in 1997 after more than 150 years. It had been under British rule since 1842 after the Chinese lost the first Opium War (1839-42) through the treaty of Nanjing.
The second Opium War (1856–60) was fought by Britain and France against China. It led to the ceding of Kowloon peninsula to the UK. The New Territories were added in 1898 on a 99-year lease. The Opium War was just about that - Britons made lots of money importing opium to China from India and elsewhere. This angered China because of increased addiction and social disruption.