TO OUTSIDERS IT was a den of vice, run by gangsters and drug-dealers. To immigrants it was a refuge. To business-owners it was a place to avoid pesky regulations. By the time it was demolished in 1994 the Kowloon Walled City, a settlement on two hectares of Hong Kong, was home to 35,000 people.

The enclave had a long and storied history. It was built in the 11th century as a trading outpost, and later became a garrison of the Chinese army. In 1898 the British government leased a tract of land surrounding its existing colony on Hong Kong Island and Kowloon: this included the area around the garrison but the Walled City never became part of the British colony, and Chinese officials were permitted to remain there so long as they did not interfere with British jurisdiction. During the second world war Japanese occupying forces took down the city’s walls and used the stone to expand Kai Tak airport. In the 1950s refugees fleeing the Communist revolution in China settled at the site. Neither Britain nor China took much notice, so squatters, factory-owners and organised-crime syndicates also moved in.

It became the most densely populated place in the world. New residents would build whatever they could in any space they could find, before developers in the 1960s replaced the unsteady shacks with solid structures. They created more than 300 interconnected towers, some of which extended to 14 precariously balanced storeys (no foundations had been laid). There were few windows and no ventilation, so the entranceways of the city’s factories and shops were often left open.

“There was no door to knock on,” says Ian Lambot, an architect, photographer and publisher who arrived in Hong Kong in 1979. “It was very easy to step off that alley and suddenly you were inside.” The residents were “indifferent or obliging”; the biggest risk was getting lost. The typical unit “wasn’t like a normal building, because the stairways would go up and then go into other buildings,” explains Greg Girard, a photographer who moved to the territory in 1974.

The two men met at a Christmas party in 1988 and discovered their mutual fascination with the Walled City. Mr Lambot wanted to tell the stories of the people Mr Girard was capturing in his portraits. With interviews conducted by Emmy Lung, a local history graduate, their collaboration became “City of Darkness”, a book published in 1992. A revised edition was released 20 years later, by which time nostalgia and popular culture had increased interest in the area. Now, having sold more than 25,000 copies of the book, their work is on public display for the first time, at the Blue Lotus Gallery in Hong Kong.

“City of Darkness” provides an insight into everyday life in this fabled place. Despite a reputation for lawlessness, police patrolled the neighbourhood from the 1950s. By the 1970s many of the most exotic businesses—brothels, opium dens and dog-meat restaurants—had moved in search of richer customers. Other operations remained, and thrived. Photographs reveal small shops with tins and cigarette boxes stacked high. A man works in a noodle factory, a cigarette hanging from his mouth; one child seems to help with the work while another is listless. A series depicts the Lees, who owned a sweet factory and wrapped the treats by hand.

Running businesses and households was not easy, particularly in the early years when no water or power was supplied. In 1977 the government decided that putting the site on the grid would be less dangerous than having people steal electricity. Mong Chung Yuk, one of the engineers responsible for the installation, describes the complications of wiring the labyrinthine buildings. Indeed, the people who created a kind of infrastructure in the Walled City have some of the most intriguing stories. Lui Man Sang is pictured on his rounds, wearing his smart Hong Kong Post uniform and hat. As head postman he devised ingenious numbering systems and routes through the buildings—which often required climbing through windows and over rooftops.

The British and Chinese governments eventually became unwilling to tolerate this anomaly in the heart of Hong Kong, and in 1987 announced that the Kowloon Walled City was to be demolished. Many residents were rehoused and compensated. Some were forcibly evicted, after “patriotically resisting” efforts by the British to interfere in what they considered Chinese land. Businesses found it harder to move, as rents in other parts of Hong Kong were much higher.

Demolition was slow, given the buildings’ unusual structure; an aerial photograph on display shows an “empty hulking shell”. A park now resides on the site, with a small exhibition about the Walled City. By chronicling the settlement while it was “thriving and alive”, “City of Darkness” provides a fascinating glimpse into a bygone place.

“City of Darkness” is on display at the Blue Lotus Gallery, Hong Kong, until December 8th