Kowloon Walled City (Chinese: 九龍城寨) was an extremely densely populated and largely lawless enclave of China within the boundaries of Kowloon City of former British Hong Kong. Built as an imperial Chinese military fort, the walled city became a de jure enclave after the New Territories were leased to the United Kingdom in 1898. Its population increased dramatically after the end of the Japanese occupation of Hong Kong during World War II, attracting mostly refugees fleeing the renewed Chinese Civil War.
By the late 1980s, the walled city contained roughly 35,000 residents within its territory of 2.6 hectares (6+1⁄2 acres), resulting in a staggering population density of over 1.2 million inhabitants per square kilometre (3 million inhabitants per square mile). As a result of the absence of any widely recognized bureaucracy, the city's residents and businesses had no municipal codes to govern them. Enabled by the enclave's anarchic nature, trade in banned products thrived, ranging from narcotics to dog meat. From the 1950s to the 1970s, it was controlled by local triad gangs and had high rates of prostitution, gambling, and drug abuse.