When I moved to Bangkok seven years ago, John lived down the hall in my building, a grim collection of one-room studio apartments with water-stained walls surrounding a small central courtyard and a tiny pool. I would run into him in the complex's dilapidated gym; he would be loading weights onto a rusting bar as I tried to fix the tread on the aging exercise bike. I was lonely in Bangkok, living alone for the first time in my life--in a foreign city where I could barely speak the language. I hadn't been homesick since my first year of summer camp, but now I sometimes cried at night. So, when John made conversation at the gym, I glommed on, desperately trying to keep our small talk going.

Until I saw John's girlfriend, that is. One evening, I noticed John with his arm around a small Thai woman. He walked upstairs and I trailed behind, recovering from my workout. As he turned to enter his apartment, I glimpsed his lady's face--the face of a preteen girl.

I remembered John, unhappily, this weekend, as news broke that the alleged killer of JonBenét Ramsey, a man named John Mark Karr, had surfaced in the Thai capital. Karr apparently had been teaching English at elite schools in Thailand and living out of a hotel. After Karr was arrested, some Thais and many foreign reporters seemed shocked that the supposed killer had turned up so far away from Colorado, in a place no one would have thought to look--perhaps why it had taken ten years for police to track him down.

Sadly, Bangkok should have been one of the first places they looked. Political scientists often blame failed states like Afghanistan or Somalia for breeding terrorism and crime. But, in actuality, criminals prefer semi-failed states or cities, where you can live a good life without worrying too much about arrest. After all, who wants to live in Kabul or Mogadishu? No, Bangkok's combination of comfortable lifestyle, sophisticated financial institutions, endemic child poverty, and lax legal system make it perfect for fugitives, sex offenders, terrorists, and other deviants.

Karr, who had faced child porn charges in California in 2001, was hardly the first. Less than a week before Karr's arrest, an infamous Australian pedophile emerged in Thailand, after being accused of sexual offenses against dozens of Australian kids. And, when I worked in Bangkok in 2000, a similar story erupted after Eric Rosser, a pianist at one of the city's fanciest hotels, admitted to local reporters after his arrest in February, "I am a pedophile. ... [N]ormal sex play of children was an obsession with me." Rosser, who also ran a music school for children in Thailand, was charged as a co-conspirator in a child porn ring back in Indiana the following month and made the FBI's Ten Most Wanted Fugitives list for his child sex crimes that year after jumping bail in Thailand.

And it's not hard to find men like Rosser and Karr in Bangkok. According to one study, Thailand's sex industry produces revenue of some $1.5 billion per year, and several nongovernmental organizations estimate that there are over 200,000 children in the Thai sex industry. Pedophile groups have set up hundreds of websites focusing on Thai children, and face, a leading Bangkok NGO, believes that at least 5,000 foreigners come to Thailand every year just to have sex with kids.

I knew the hotel district where Karr lived well; it was located near one of Bangkok's red-light districts. Friends and I used to frequent a (non-sex) dive bar in the area famous for its collection of old rock and jazz records and videos. When we'd stumble out after too many glasses of Singha, we'd walk by crowds of sixtysomething men leading preteen boys and girls by the hand in the street, often taking them back to the Malaysia Hotel, a seedy joint full of child prostitutes and drug dealers.

Sometimes, the sixtysomethings would take their victims to nearby Pattaya, a sleazy beach resort two hours from Bangkok where street urchins wander the town, selling flower garlands and offering sex for two or three dollars. There, the foreign men would blend into the crowds of pedophiles. Unlike other neighboring countries--such as Cambodia, which also has a serious child prostitution problem, but where the number of resident foreigners is so small that pedophiles stand out more--Thailand has so many foreign residents that local police could never track all the law-breakers.

Though Thailand has tried to crack down on child sex and other crimes by foreigners, even when the Thai police do make an arrest, they often cannot hold onto their man. In 2003 alone, Thai authorities fired 18 cops for their complicity in trafficking, and police often take cuts from brothels. A few months after Rosser was arrested, I wound up tracking another story. An Indian man named Chhota Rajan, alleged to be a major mafia leader in Bombay, had somehow escaped from a Bangkok hospital by climbing out the window on a rope, even though he was under police guard.

Little wonder, then, that the United States has passed a law making it easier to prosecute pedophiles in the United States, rather rely on Thailand's legal system. Now, Karr is back in the States, ten years too late.

Joshua Kurlantzick is a special correspondent for The New Republic.