Recently discovered artifacts dating back to Neolithic times indicate that Hong Kong has been inhabited for millennia; the earliest modern peoples are thought to have come there from North China in the second millennium B. C. China claimed Hong Kong and its environs about 2,000 years ago, during the Han Dynasty. The Cantonese and later the Hakka settled in the area around the fourteenth century. With its mountainous terrain and lack of fertile soil and fresh water, it was natural that Hong Kong early on became an economic center. With trade came trouble; imperial records mention troops assigned to the area to guard the pearls harvested by the Tanka, while the other two trades plied in Hong Kong appear to have been fishing and opium traffic. The Manchus wiped out the piracy that became rampant by temporarily evacuating Hong Kong in the seventeenth century.
The British, expanding into Asia in the early nineteenth century, recognized the value and strategic importance of Hong Kong's deepwater harbor and began to use it by 1821 to anchor opium-carrying vessels. China's rulers, concerned about the effect of opium on the county's populace, eventually sought to prevent the importation of opium. British resistance to Chinese Imperial control resulted in the first Opium War (1839–42), in consequence of which, Britain gained control of Hong Kong Island. The conflict continued, and less than two decades later the second Opium War erupted (1856–60), after which Kowloon Peninsula and Stonecutters Island were ceded to the British by the Convention of Peking (1860). Hong Kong's 235 outlying islands and the New Territories were later leased to Britain for 99 years by the terms of the Convention of 1898. Hong Kong's previously small population had grown to 120,000 by 1861 and to more than 300,000 at the turn of the century.
Subsequent relations between China and Britain were largely antagonistic for the next few decades. Burgeoning Chinese nationalism nurtured a concomitant xenophobia, and Hong Kong became a refuge for political refugees from mainland China after the Chinese Republic was established in 1912. From 1925 to 1927, the Chinese denied British ships access to ports in southern China. In the face of growing hostilities between China and Japan, beginning with Japan's occupation of Manchuria in 1932 and culminating in the Sino-Japanese War in 1937, China looked to Europe for military supplies and support, and Anglo-Chinese diplomatic relations improved. Hundreds of thousands of Chinese fled to Hong Kong as a result of Japan's invasion of China. Britain strengthened the colony's defenses, but they proved inadequate, and the Japanese took Hong Kong in December, 1941, during World War II (1939–1945). Britain regained control after Japan's surrender in 1945, by which time Hong Kong's population had dropped to 650,000 from its prewar peak of 1.6 million.
Hong Kong's postwar economic recovery proceeded only gradually. A large influx of refugees from the mainland after the Communists took power in Beijing in 1949 added substantially to Hong Kong's population and labor force, but the city's economy was hampered by a U.S. ban on trade with Communist China in 1950. Hong Kong eventually underwent an economic boom by the 1960s, due primarily to heavy foreign investment encouraged by liberal tax policies. Political stability was tested by Communist-inspired riots in 1967, but Hong Kong weathered the storm, and more refugees came from the mainland in the 1970s. However, economic and other ties between Hong Kong and the mainland improved throughout the 1970s and 1980s.
On July 1, 1997, Hong Kong was returned to Chinese sovereignty by Britain according to a 1984 agreement which refined the stipulations of the Convention of 1898. A committee appointed by China from among Hong Kong's civic leaders had designated Tung Chee-hua as Hong Kong's chief executive, and the former British colony became a Special Administrative Region (SAR) under the direct control of China's central committee. Although the 1984 agreement guaranteed the survival of the established legal, social, and economic systems of Hong Kong for the next 50 years, an interim legislative council had already approved restrictions on political rights in Hong Kong before the Chinese resumed control in 1997. Hong Kong's economy suffered along with others in Asia in the subsequent economic recession that affected the region. In the legislative elections in May 1998, most of the open seats were won by pro-democracy candidates.