The snarkosphere had a good laugh last summer when an inmate at a Michigan jail sued the state for depriving him of pornography in spite of his professed “chronic masturbation syndrome.” The case was dismissed in August because the plaintiff, 22-year-old Kyle Richards, a convicted bank robber who got busted after police followed a trail of cash through the snow to his apartment, did not pay a $350 filing fee. But last month Richards pressed his case further, filing a new suit against a Detroit Fox television station for mocking his masturbatory condition with “degrading and slanderous” coverage.

Richards may be a bit of a nut—his suit also names “the United States” as a defendant—but to many inmates, the fight for the right to masturbate is no laughing matter. In October, a group of inmates in Connecticut launched a letter-writing campaign to protest a planned ban on porn in state prisons set to begin next summer. Connecticut officials claim porn undermines prison security and creates a hostile work environment for staff. But the prisoners say access to porn is their constitutional right. They want the state either to nix the nudie-mag ban or provide access to X-rated cable TV in order to alleviate their sensory deprivation.

The deprivation does not end with porn, though. While you might think of masturbation as a sort of last refuge for the incarcerated—a truly inalienable freedom, given the happy proximity of the sex organs—that is not the case. In fact, a number of state prisons regard jerking off as a rule infraction. American University law professor Brenda Smith, who conducted a 50-state survey of prison masturbation policies in 2006, says restrictions are “well-entrenched” in the correctional environment. In North Carolina, for example, it is a violation to “touch the sexual or other intimate parts of oneself or another person for the purpose of sexual gratification.” Violations can lead to disciplinary segregation or the loss of “good time” credits. Tennessee forbids “[a]ny behavior intended for the sexual gratification of the subject.” Ohio prohibits “[s]eductive or obscene acts, including indecent exposure or masturbation.” Kentucky regards inmate masturbation as “[i]nappropriate sexual behavior.” In California, where some 170,000 men and women live behind bars, masturbation is permissible provided it is stopped immediately if noticed by staff, blue balls be damned. If the masturbator perseveres, even if concealed by bed sheets, he can be cited for “Intentionally Sustained Masturbation without Exposure.” These policies are part of a long correctional tradition to forbid all forms of sexual activity. Prison officials say they need the rules to keep order and deter exhibitionism.

In practice, inmates are seldom sanctioned, so long as they touch themselves discreetly. In Connecticut, masturbation is against the rules only when performed “in a lewd and public manner.” Other states have similar policies. But the line between intentional and inadvertent exposure can be blurry in a context where inmates do not control their privacy and cells are sometimes defined as public places. What’s more, some experts on prison sex contend that anti-masturbation and anti-porn policies in prisons are counterproductive because they effectively drive inmates to engage in risky sexual behavior. According to this theory, increased access to pornography—which goes hand-in-hand with increased access to one’s doo-dads—might be just what correctional facilities need to stem prison rape. Is it time for a revolution in prisoners’ masturbatory rights?

It would be quite the turnaround. In centuries past, prison masturbation was a well-known scourge. An 1845 report from Philadelphia County Prison, for instance, identified onanism as the root cause of numerous fatal cases of mania and tuberculosis. The challenge for wardens was that the idleness of prison life seemed naturally to give rise to the vice. “The genital sense is excited in a much more terrible manner than usual when man remains for a long time in solitude,” wrote one mid-19th-century physician who believed exercise could help stem prison wanking. Another prison doc of the era noted that when female inmates were held in the same building as men, rates of “self-abuse” shot through the roof. In 1883, exasperated officials at a Pennsylvania penitentiary posted placards in every cell warning “addicted” wankers that their habit caused “speedy death” and begging them to “Stop, at once Stop!” Doctors at New York’s Elmira Reformatory took a more hands-on approach: They chloroformed masturbators and implanted metal rings through their foreskins.

Recorded cases of masturbation-induced illness and death began to decline in the first decades of the 20th century thanks to the triumph of germ theory and a dawning awareness that microbes like the syphilis spirochete caused disease, not the squandering of bodily fluids. Around the same time, U.S. prison sex policies took a swing to the permissive, when the nation’s first conjugal visitation program opened at Mississippi State Penitentiary at Parchman in 1918. Informed by racist beliefs common to the era, the program initially served only black inmates and was designed in part to suppress aggression by letting the prisoners vent their purportedly immense sexual energies. (White inmates weren’t allowed to partake in the program until around 1940.) Still, the idea that sexual amenities could or should be part of the American correctional tradition never gained wide acceptance. Prison policy in the U.S. grew more punitive in the ’70s with the emergence of the “victims’ rights” movement and the reinstatement of the death penalty. In 1980, a federal task force decided against allowing conjugal visits in federal prisons amid concerns over contraband smuggling and worries that inmates might game the system by marrying acquaintances. Today only six states allow conjugal visits, down from more than a dozen two decades ago.

Masturbation is one amenity that is hard to take away. The few studies of prison masturbation that exist suggest it is a common behavior, despite restrictions on its performance. A 2001 survey of 142 male inmates in a Southern maximum-security prison found that all but one of them, or 99.3 percent, said they had masturbated while incarcerated. A study of female inmates the same year found a rate of 66.5 percent. Among men, well-educated prisoners were more likely to be frequent masturbators. In both men and women, prisoners who were sexually active behind bars were more likely to touch themselves on a regular basis.

While these studies show masturbation can flourish under adversity, frontal attempts by inmates to win the right to masturbate have failed. In 1992, Otis Rodgers filed suit against the Ohio Department of Corrections and Rehabilitation claiming that its policy against masturbation and conjugal visits infringed on his human rights. Rodgers said Ohio’s ban had caused him to endure embarrassment and degradation due to recurring nocturnal emissions. An affidavit identified two reasons for Ohio’s prohibition: First, because of close cell quarters, “such acts are not conducive to the orderly operation of the prison environment”; and, second, “such acts would serve to promote and increase the risks of contracting or spreading any number of anti-social diseases (i.e., venereal disease, AIDS, etc.).” Rodgers lost on appeal; the court ruled that Ohio’s prison administrators were free to set policies at their discretion.

The result is that prisoners do sometimes get in trouble for engaging in autoerotic behavior. Early on the morning of May 16, 2000, in South Carolina’s Lieber Correctional Institution, Officer Patricia Sinkler saw inmate Freddie Williams “in the front entrance of the shower, curtains open, with his left hand propped up against the wall, turned sideways, making back and forth movements with his right hand on his penis,” according to a court document. Sinkler filed a disciplinary report recommending that Williams be charged with sexual misconduct, and he was brought before a hearing officer and convicted. Williams appealed multiple times, insisting he had not intentionally exposed himself; the officer had simply walked past when he was going at it. He lost and had to relinquish 240 good-time credits.

A similar case occurred in Florida in 2006: Broward County inmate Terry Lee Alexander was sitting alone on his bunk masturbating when a female deputy who was monitoring him from a central control room more than 100 feet away took exception to Alexander’s “blatant” exertions and wrote him up. Alexander was charged and convicted of exposure, with the jury determining that a cell is “a limited access public place.” The same deputy had also filed reports on seven other locked-up masturbators. When Alexander’s attorney asked the deputy in court if she had considered calling a SWAT team to halt his client’s activity, she replied, “I wish I had.”

Both of these incidents highlight a new factor in the correctional environment: the female prison guard. In many institutions, women are steadily replacing men because prisons prefer to hire guards without criminal records and with some education beyond high school—both of which favor female applicants. Female guards have another virtue: In most jurisdictions, they can legally oversee housing units for both male and female inmates, whereas men often are permitted to guard and conduct pat-searches only on other men. The result is that male inmates are accorded less privacy in which to masturbate than female inmates, says Brenda Smith, the law professor. “Women are in these environments, and they can look into the cell. They come by and the guy is masturbating and all of a sudden [the guards think] it’s about them. When in fact it isn’t. Then those guys get written up, when they didn’t even know she was coming.”

Prisons must also protect female guards from the hostile work environment that ensues if inmate masturbation is not held in check. This was established in a case that reached the 9th Circuit Court of Appeals in 2006 involving a female guard who was repeatedly exposed to exhibitionist masturbation. In 1998 and 1999, Officer Deanna Freitag was sometimes tasked with monitoring the exercise yard at Pelican Bay State Prison’s Secure Housing Unit, which holds many of California’s most violent criminals. Somehow it became an inmate tradition to openly jack off when she was in the control tower. Freitag started writing up the serial masturbators, but her superiors ignored her reports—they told her exposure to misbehavior was part of the job and that “it’s only sex.” Freitag filed a formal complaint with the state. Pelican Bay found a reason to fire her. The fight wound up in court.

The facts were not really in dispute: A state inspector general’s report showed that female officers at Pelican Bay were regularly exposed to exhibitionist masturbation, and that administrators knew about it and did little to prevent it. (Many prisons install semi-opaque, one-way glass on control towers so officers can see out but inmates can’t see in.) Several female Pelican Bay officers testified that the pattern of masturbation had undermined their authority. The court concluded “with little difficulty” that the state was liable for maintaining a hostile work environment.

But most female correctional officers do not define inmate exhibitionism as sexual harassment, according to prison research conducted by sociologist Dana M. Britton. Even if they find it gross, most female guards ignore chronic masturbators or simply make fun of them. One female guard told Britton that whenever inmates start to “search for something in their pants,” she starts teasing them about their paltry display. “[N]ext time you’re on the cell block, he’ll be under his covers,” the guard insisted. Inmates sometimes refer to exhibitionist masturbation as “gunning” or “killing,” and it’s a familiar behavior. “This really didn’t get to be an issue until women started working in higher security penitentiaries,” says anthropologist Mark Fleisher, who authored a report on prison sex for the Department of Justice.

The threat of sexual harassment is now also used as a justification for keeping porn out of prisons. In enacting its new porn ban, Connecticut said explicit materials create a hostile environment for staff. Pennsylvania’s 2006 ban was designed to improve working conditions for women. (A representative with Pennsylvania’s prison guard union told the AP that inmates tack centerfolds to their cell walls “as a shield” to repel female staff.) This year the 10th Circuit Court of Appeals heard a case involving a Kansas inmate who said the state’s porn ban violated his First Amendment rights. The Court disagreed and relied on testimony from a state official who said porn can be used by inmates to sexually harass staff, tends to disrupt security, endangers gay inmates by enabling their identification, and may negatively impact sex offenders.

But do “dirty” magazines really cause all these problems? What if porn—and its natural consequence, masturbation—has the potential to deter sex crimes like prison rape? That’s what some sex researchers are saying, some 25 years after a controversial commission led by former Attorney General Edwin Meese issued a report suggesting a link between viewing hard-core porn and sexual violence toward women.* Today some scholars still emphasize the risks: In 2009, one academic review paper concluded that the totality of the evidence indicates using porn is a risk factor for sexual aggression. In 2008, a federal review panel on prison rape recommended banning porn in prisons. “Magazines? You may as well be throwing them six-packs,” says anthropologist Mark Fleisher.

But others insist the porn debate is over—and that porn has been vindicated. Another review paper on porn and sexual aggression from 2009 points out that as the availability of sexually explicit content has exploded in the Internet era, sex crimes have dropped nearly everywhere the matter has been studied. That doesn’t match with the theory that using porn facilitates rape, and some researchers even argue that porn might have a protective effect, by giving people a safe outlet for pent-up desires. One scientist told Congress in 1984 that patients seeking treatment in sex offender clinics often say porn helps them restrict their urges to their imaginations rather than acting them out by force. In effect, masturbation displaces rape.

In free society, at least, masturbation is evidently displacing something. There are only so many hours in the day, and the number of people who say they enjoy masturbation is rising. Studies of autoeroticism across societies—in Finland, in Estonia, in Russia, in France—indicate that masturbation trends among men and women of all ages are pointing up. Government authorities in parts of Britain and Spain are even getting aboard the autoerotic bandwagon, running pro-orgasm campaigns with slogans like “Pleasure is in your own hands.” According to Finnish sex researcher Osmo Kontula, two-thirds of masturbators use porn to liven up the process. “I’m not sure how popular it was in the Stone Age,” says Kontula, who has studied autoerotic behavior internationally and across generations. “[But] I can confirm that masturbation has increased significantly in recent decades. … It is also more popular than ever before.” The golden era of masturbation is at hand.

And yet in prisons, Stone Age attitudes toward self-stimulation, porn, and sexuality still rule the yard. Only two states, Vermont and Mississippi, offer inmates access to condoms, despite high prison rates of HIV and hepatitis. Correctional officials may wish inmates were sexually inert, but a more pragmatic attitude might yield better results. “If you allow for autoerotic behavior, if you allow for conjugal visits, if you allow for protected consensual sex, those things should reduce prison rape. They should also reduce, of course, sexually transmitted diseases,” says prison sex researcher Christopher Hensley. And what about the God-given right to masturbate? That’s one freedom inmates deserve.