One of humankind’s greatest fears is a dystopian future in which monkeys rule the planet. In Lopburi, Thailand…that future is here.

Lopburi’s main attraction is the 13th century ruin of the Phra Prang Sam Yot temple. More accurately, the attraction is the sight of thousands of crab-eating macaques that have staked a claim on the temple’s grounds. Even though Thailand is largely a Buddhist country, its mythology borrows heavily from Hinduism, in which the monkey god Hanuman plays an important part. Monkeys, therefore, are considered sacred when in or near a temple, and the macaques of Lopburi have exploited this loophole to their advantage.

Step off the train in Lopburi and you’ll be greeted immediately by the surreal site of monkeys comfortably integrating themselves into urban life. They repose on curbs and electrical boxes. They scurry between traffic. They have shame-free public sex atop the power lines.

Shopkeepers have installed special doors and plastic flaps to prevent primate intrusion into their stores. Hotels have surrounded themselves with cages, creating a sort of reverse zoo. But on the grounds of Phra Prang Sam Yot not only are the monkeys welcome, they are fed and watered. And adored by tourists.

At the entry point of the temple my wife and I paid the modest admission fee and kicked in an extra couple baht to buy some bags of diced sweet corn. The monkeys instantly saw us coming, and we greeted their approach with equal parts delight and fear.

At first we tossed them bits of corn from afar, but soon we grew brave enough to hand them the kernels directly. Within moments of crossing this boundary, we had crab-eating macaques climbing on us.

The ticket/corn salesmen taught us to spin in a circle if we ever wanted to shake off a bothersome monkey, but the novelty of having these exotic animals clamber up our legs and rest on our backs was so much fun.

At first.

It quickly became apparent that you can’t reason with a monkey about equitable distribution of wealth. When we offered corn to the younger, shyer monkeys it would often be snatched away by the older, more aggressive ones. But we did our best to make sure the babies got fed, too.

The temple itself is relatively unremarkable compared to its UNESCO-protected brethren in nearby Ayutthaya, but walking through it was still an arresting glimpse 800 years into the past. And it really provides a stunning backdrop for monkey photos.

The most common bit of advice given to anyone visiting the temple is to be aware of the thieving nature of its resident macaques. We made sure not to wear any hats or sunglasses, and we had tucked our wallets and phones deep into our tightly sealed backpacks.

One of the other tourists didn’t get the memo, though. We heard a commotion at one point and turned to see a monkey dart from the ground up to the temple’s roof, gripping a hat in its paws. One of the ticket/corn salesmen fired off a slingshot, narrowly missing the monkey who escaped with the loot. I understand why the monkeys would snatch water bottles and granola bars, but what do they do with all the hats and jewelry and sunglasses and scrunchies and cameras? (Only possible answer: secret monkey fashion shows when no one’s looking.)

Despite our preparations, we still fell victim to a common monkey scam. While a few monkeys climbed on my wife’s back to distract her, another ran up out of nowhere and swiped her bag of corn. But after a couple laps around the temple we became adept at avoiding the troublemakers, and we doled out our corn as fairly as the laws of nature would allow.

Our comfort level, therefore, wasn’t immediately tested when some of the monkeys showed an interest in tugging at my wife’s hair tie. It was cute. Hair ties are cheap. It didn’t seem like a big deal when she had two monkeys on her back. Or three. Or four.

But five started to seem like a bit much…

Soon there were multiple monkeys with multiple motivations, overstimulated by the stubborn hair tie and the frustrating lack of corn in my wife’s hand. They became aggressive with each other, and her body was their battleground. She attempted the spin move that we had been taught at the entrance, and the monkeys scattered as promised.

But, in the process, she got bit.

Thankfully the bite didn’t break her skin, it was just a nasty scratch. We pointed out the wound to the ticket/corn salesmen and they laughed it off and told us not to worry. I suppose they deal with superficial monkey-related lacerations on a regular basis without incident, so it didn’t seem like anything worth fussing about.

We took them at their word and didn’t bother with a rabies shot, which, in retrospect, was mega dumb: rabies can still be transmitted even if blood isn’t drawn. We spent the next several days vigilantly watching for symptoms to appear, but if they had it would’ve been too late for treatment, and death would’ve been the likely outcome. Thankfully my wife survived both the bite and our careless stupidity.

Was it worth living under the cloud of potential death just to spend an hour or two hanging out in a city of monkeys? Yes. And I assume that sentiment is the basic working thesis of the Lopburi tourism board.

A far more unsettling prospect is the idea of a careless tourist accidentally leaving behind a copy of The Anarchist Cookbook at Phra Prang Sam Yot. Because then the revolution will truly be underway.