It was the end of an era: In July 1997, as the flag of the United Kingdom was lowered over Hong Kong, the prosperous colony was returned to China after over 150 years of British rule. The sun had finally set on one of the wealthiest modern outposts of the British Empire. But was it the beginning of lasting autonomy for Hong Kong?

The United Kingdom had held Hong Kong as a colony since 1841, when it occupied the area during the First Opium War. The war broke out after Qing-dynasty China attempted to crack down an illegal opium trade that led to widespread addiction in China. Defeat came at a high cost: In 1842, China agreed to cede the island of Hong Kong to the British in perpetuity through the Treaty of Nanjing.

Over the next half-century, the United Kingdom gained control over all three main regions of Hong Kong: After Hong Kong Island came the Kowloon Peninsula, and finally the New Territories, a swath of land that comprises the bulk of Hong Kong today. The final treaty, the 1898 Convention for the Extension of Hong Kong Territory, leased the New Territories to Britain for 99 years. Under the terms of the treaty, China would regain control of its leased lands on July 1, 1997.

British Hong Kong’s trajectory was different from that of mainland China, which became a Communist country in 1949. Up to 100,000 Chinese found refuge in Hong Kong after the Communist Party took power. Capitalist Hong Kong soon experienced an economic boom, becoming home to a multicultural, international community.

As the treaty’s expiration loomed, separating the New Territories from the rest of Hong Kong became increasingly unthinkable. Starting in the late 1970s, the U.K. and China began to discuss Hong Kong’s future. In 1984, British Prime Minister Margaret Thatcher and China’s premier Zhao Ziyang signed the Sino-British Joint Declaration, agreeing that China would give Hong Kong some political and social autonomy through a “one country, two systems” policy for a 50-year-period.

After the handover, Hong Kong became a Special Administrative Region of China with its own “mini constitution,” legal system, and some democratic rights like free speech and the freedom of assembly under its Basic Law. However, Hong Kong residents cannot elect their own leaders; rather, a chief executive is elected by a 1,200-member election committee.

Starting in 2014, elections were conducted using a list of candidates vetted by Beijing. That and other Chinese policies, like a recent attempt to allow extradition to the mainland, have led to mass protests, strained British-Chinese diplomatic relations, and fueled increasing concerns that China is stifling public dissent, interfering in local politics, and eroding human rights in Hong Kong.