system
You are a knowledgeable assistant with access to a given context. Always provide responses that are relevant to the context provided.


user
Context: Hong Kong (US: /ˈhɒŋkɒŋ/ or UK: /hɒŋˈkɒŋ/; Chinese: 香港, Cantonese: [hœ́ːŋ.kɔ̌ːŋ] (listen)), officially the Hong Kong Special Administrative Region of the People's Republic of China (abbr. Hong Kong SAR or HKSAR), is a city and special administrative region of China on the eastern Pearl River Delta in South China. With 7.5 million residents of various nationalities in a 1,104-square-kilometre (426 sq mi) territory, Hong Kong is one of the most densely populated places in the world. Hong Kong is also a major global financial centre and one of the most developed cities in the world.

Hong Kong was established as a colony of the British Empire after the Qing Empire ceded Hong Kong Island from Xin'an County at the end of the First Opium War in 1841 then again in 1842. The colony expanded to the Kowloon Peninsula in 1860 after the Second Opium War and was further extended when Britain obtained a 99-year lease of the New Territories in 1898. British Hong Kong was occupied by Imperial Japan from 1941 to 1945 during World War II; British administration resumed after the surrender of Japan. The whole territory was transferred to China in 1997. As one of China's two special administrative regions (the other being Macau), Hong Kong maintains separate governing and economic systems from that of mainland China under the principle of "one country, two systems".

Originally a sparsely populated area of farming and fishing villages, the territory has become one of the world's most significant financial centres and commercial ports. As of 2021, it is the world's ninth-largest exporter and eight-largest importer. Hong Kong has a market economy characterised by a focus on services, low taxation and free trade; its currency, the Hong Kong dollar, is the eighth most traded currency in the world. Hong Kong is home to the third-highest number of billionaires of any city in the world, the second-highest number of billionaires of any city in Asia, and the largest concentration of ultra high-net-worth individuals of any city in the world. Although the city has one of the highest per capita incomes in the world, severe income inequality exists among the population. Most notably, housing in Hong Kong has been well-documented to experience a chronic persistent shortage; the extremely compact house sizes and the extremely high housing density are the effects of Hong Kong's housing market being the most expensive housing in the world.

Hong Kong is a highly developed territory and has a Human Development Index (HDI) of 0.952, ranking fourth in the world. The city has the largest number of skyscrapers of any city in the world, and its residents have some of the highest life expectancies in the world. The dense space has led to a highly developed transportation network with public transport rates exceeding 90%. Hong Kong is ranked 3rd in the Global Financial Centres Index.


Question: Extract the year when Hong Kong was established


assistant
Hong Kong was established in 1841 as a colony of the British Empire after the Qing Empire ceded Hong Kong Island from Xin'an County at the end of the First Opium War.