For years, Nick Dubin couldn’t bring himself to say the word ‘gay,’ but part of him wondered: Was he gay? Dubin has autism. And growing up in the suburbs of Detroit, Michigan, he had been mercilessly taunted by his peers, some of whom had called him gay simply because he was different.

But what if he actually was homosexual? As an adult, Dubin found some men attractive, and his attempts at dating women had not gone well. To help him understand his sexuality, Dubin recalls, a therapist he was seeing in 2010 suggested he buy a few adult pornography magazines. Dubin is soft-spoken and comes across as earnest, and he took the therapist’s advice seriously. He drove to a seedy part of the city and purchased a handful of magazines. He also began looking at pornography on the internet. He recalls being surprised that it was free and so easy to find. Soon he was bombarded with pop-up ads for porn sites. Some of the ads he clicked on led to sites with pictures of minors, which he downloaded to his computer.

At the time, Dubin was 33 and had built an impressive career as an autism advocate. He had a doctorate in psychology and was working as a consultant in a nearby school for autistic students. By all appearances, he was someone who should have known that child pornography is wrong. “This is what’s often confusing to people who have not dealt with autism spectrum [disorder] before,” Lynda Geller, a New York City-based psychologist and autism specialist, said at a conference on the topic in Rochester, Michigan, in May. “They see before them someone that they’re talking with who seems quite bright, and yet whose social intelligence is quite different than their intellectual intelligence.”

That disconnect seemed to hold true for Dubin. One test that estimates a person’s social age revealed that he functions as a 7- to 11-year-old child. In someone with such a young social age, Geller says, the ages of children in photographs may not register as they would for a typical adult. Dubin says he has never had sexual feelings about children, and it had never occurred to him that looking at naked pictures of minors is against the law: “I had no concept of how something I was doing in the privacy of my home without interacting with anyone could be breaking the law,” he says.

This grave miscalculation changed his life forever.

Later that year, just after dawn one Wednesday, a dozen agents from the U.S. Federal Bureau of Investigation (FBI) forced open the door of his apartment. They handcuffed him and told him they had a search warrant. Dubin thought at first that the men were from the fire department. He asked them repeatedly why they were there. “You want to tell us about something on your computer?” one agent finally said. Dubin was arrested and ultimately convicted for possessing child pornography.

Dubin is one of many autistic individuals who have become embroiled in the criminal justice system because of their sexual behavior. Some, like Dubin, have found themselves in legal trouble for viewing or collecting child pornography, whereas others have been charged with stalking, masturbating in public, harassment or sexual assault. Some are serving prison sentences. And hundreds, if not thousands — the numbers are impossible to pin down — including Dubin, have become registered sex offenders, a status that can prevent them from receiving state services and finding jobs for the rest of their lives.

Many of these autistic people may have engaged in sexual behaviors without understanding the implications of their actions or the law. People on the spectrum often have problems with social communication, awareness and experience. That, coupled with other hallmark traits associated with autism — including intense interests and repetitive behaviors, as well as sensory differences — can unwittingly cause problems when they start dating or exploring their sexuality.

For these reasons, some experts are calling for a change in how the criminal justice system treats autistic people. The 2018 sentencing guidelines for U.S. courts directly acknowledge that shorter sentences may be warranted when a defendant’s mental capacity contributes substantially to the commission of the offense. But it is not clear how that comes into play for people on the spectrum.

“There should be an escape from sex-offender registration for those with autism spectrum disorder who are first offenders with no history of inappropriate contact with children,” says Mark Mahoney, a lawyer familiar with Dubin’s case. Some studies show that registration laws generally do not have the effect of deterring sexual offenses — in part because most sex crimes are committed by relatives and acquaintances, not by strangers. And registration can have particularly devastating effects on autistic people’s lives: It further isolates and stigmatizes them, and also limits their access to services and benefits.

“I am not the type of person who would ever intentionally harm another human being,” Dubin says. His parents, lawyers and therapists agree.

In addition to legal reform, people on the spectrum would also benefit from sex education, Dubin and others say. Autistic people are much less likely than their neurotypical peers to receive any kind of sex education, either at school or at home, according to one 2015 study. And without education, sexual rules — often unspoken and riddled with nuance — can be among the most difficult to parse. “People on the autism spectrum are notoriously law-abiding rule followers,” Geller said at the conference in May. But “if they don’t know a rule, they don’t follow it.”