Hong Kong, officially the Hong Kong Special Administrative Region of the People's Republic of China maintains a separate political and economic system from China. Except in military defence and foreign affairs, Hong Kong maintains its independent executive, legislative and judiciary powers.
In addition, Hong Kong develops relations directly with foreign states and international organisations in a broad range of "appropriate fields
Remnants of burial grounds and early rock carvings show human life in Hong Kong as far back as the Stone Age.
The territory is thought to have come into the fold of the Chinese empire under the Han dynasty between 206 BC and 220 AD.
Increasing numbers of Han Chinese from the mainland began to settle in Hong Kong, alongside boat-dwelling communities also thought to have originated from southern China.
Hong Kong's sheltered main harbour became a place to replenish supplies for trading ships plying the maritime silk road between Asia, Africa, and the Middle East, which flourished from around the 7th century.
As well as silk, China exported porcelain and tea and received everything from spices to plants and textiles.
Hong Kong's outlying islands were also a haven for Chinese pirates -- its current territory includes 260 islands, many of them uninhabited.
Portuguese, Dutch and French traders arrived on the south coast of China in the 1500s and Portugal set up a base in Macau, neighbouring Hong Kong.
But in the 18th century China imposed restrictions on the Europeans in a bid to contain their influence.
Britain was angered after an imperial edict banned its trade in opium from India to China, which had led to the spread of addiction.
After Chinese authorities seized a vast haul of the drug, Britain attacked in 1840 and reached northern China, threatening Beijing, in the First Opium War.
To make peace, China agreed to cede Hong Kong Island to Britain in 1841.
The Kowloon peninsula followed in 1860 after a second Opium War and Britain extended north into the rural New Territories in 1898, leasing the area for 99 years.
Hong Kong was part of the British empire until 1997, when the lease on the New Territories expired and the entire city was handed back to China.
Under British rule, Hong Kong transformed into a commercial and financial hub boasting one of the world's busiest harbours.
Anti-colonial sentiment fuelled riots in 1967 which led to some social and political reforms -- by the time it was handed back to China, the city had a partially elected legislature and retained an independent judiciary.
Hong Kong boomed as China opened up its economy from the late 1970s, becoming a gateway between the ascendant power and the rest of the world.
Return to China
After lengthy negotiations, including between Deng Xiaoping and British Prime Minister Margaret Thatcher, the future handover of Hong Kong was signed off by the two sides in 1984.
On 1 July 1997, the transfer of sovereignty over Hong Kong from the United Kingdom to the People's Republic of China took place, officially marking the end of Hong Kong's 156 years under British colonial governance.
The Sino-British declaration said Hong Kong would be a "Special Administrative Region" of China, and would retain its freedoms and way of life for 50 years after the handover date on July 1, 1997.
While initial fears of a crackdown did not materialise, concerns have grown in recent years that China is tightening its grip.
Democratic reforms promised in the handover deal have not materialised and young activists calling for self-determination or independence have emerged.