“Thought Crimes: The Case of the Cannibal Cop.” (Courtesy of HBO)

Everybody’s got their somethin’ — a little dark and private thought that got in there somehow and won’t stop rattling around. Some of these quirks are socially acceptable and can therefore be made public, which is good news for the dominatrix industry as well as all those anime furries wandering around at the sci-fi convention. Many obsessions can be illegal if acted upon, but our you-do-you society widely accommodates forms of kink that used to be so taboo hardly anyone knew they existed.

And then there’s the cannibal cop.

Remember him? Arrested in 2012 for conspiring to cook and eat a number of women, former New York police officer Gilberto Valle was eventually convicted and served 22 months in jail before a judge overturned his conviction.

As seen in Erin Lee Carr’s unsettling but educational documentary for HBO, “Thought Crimes: The Case of the Cannibal Cop” (premiering Monday), the most important fact in the case was deemed immaterial by his accusers: Valle never acted on any of his sick fantasies. He never physically or verbally threatened, assaulted or kidnapped a victim. He certainly never ate one.

Here, of course, is where the Internet comes in. Our greatest technological achievement is also, as everyone now knows, our biggest can of worms. Like so many overworked, exhausted and increasingly distant spouses, Valle spent insomniac hours online. Doing what? his wife wondered. She logged on and found out: Her husband was spending those hours in places like DarkFetishNet, sharing fantasies of kidnapping, torturing, cooking and eating women.

As best his wife could tell, Valle was planning with other Dark­Fetish chat-room members to commit such horrors against her, so she turned him in. (Others were arrested as Valle’s co-conspirators.) Carr catches up with Valle under house arrest at his mother’s place, where he is fairly forthright about how his fetish got to the point that it did. Carr wisely approaches her subject with empathy and curiosity but not advocacy; as a potential creep, Valle might never fully acquit himself. His fantasies appeared to have bled into his real life; the women he knew best were the ones he dreamed of killing.

But because he didn’t (and swears he never intended to), Valle’s case presents us with Orwellian questions about how our thoughts constitute crimes, especially if we leave evidence of these thoughts in our browser histories and online entries. Carr pushes this story beyond its tabloid luridness to discover that even legal experts, psychologists and Internet ethicists are somewhat flummoxed — if not by the fact that Valle was prosecuted in the first place, then by the limits of what any of us could be charged with.

“Thought Crimes” is yet another entry in what has been a remarkable stretch of projects lately for HBO’s documentary department. Many of these have were blessed with big buzz — “The Jinx,” “Going Clear,” “CitizenFour,” a two-night Frank Sinatra biography and “Kurt Cobain: Montage of Heck.”

But HBO’s commitment to smaller films about far less tidy or showy subjects can often lead to more memorable work. Recent examples of this include Nick Broomfield’s “Tales of the Grim Sleeper,” which premiered April 27 and examines the shamefully lax way in which police failed to investigate the disappearance and murders of black prostitutes in South Central Los Angeles; and, premiering May 18, Gillian Laub’s “Southern Rites,” which examines a racially charged murder case with a strange twist in a Georgia county that until recently had segregated high school proms.

HBO isn’t alone in championing worthy documentaries. Showtime has upped its game in the field, and Netflix is elbowing in. The “POV” and “Independent Lens” series on PBS also deliver one-of-a-kind documentary projects and, when we’re lucky, our local affiliates air them at an hour when viewers might notice.

As the broadcast networks engage in their annual “upfront” ritual of canceling shows and unveiling new ones this week, I keep hearing complaints from readers about all the junky reality shows that are still on.

To which I always respond: Are you watching enough documentaries?

Thought Crimes: The Case of the Cannibal Cop

(85 minutes) premieres Monday at 9 p.m. on HBO, with encores.