The anonymous author of the pamphlet Onania (1716) was very worried about masturbation. The ‘shameful vice’, the ‘solitary act of pleasure’, was something too terrible to even be described. The writer agreed with those ‘who are of the opinion, that… it never ought to be spoken of, or hinted at, because the bare mentioning of it may be dangerous to some’. There was, however, little reticence in cataloguing ‘the frightful consequences of self-pollution’. Gonorrhoea, fits, epilepsy, consumption, impotence, headaches, weakness of intellect, backache, pimples, blisters, glandular swelling, trembling, dizziness, heart palpitations, urinary discharge, ‘wandering pains’, and incontinence – were all attributed to the scourge of onanism.

The fear was not confined to men. The full title of the pamphlet was Onania: Or the Heinous Sin of Self-Pollution, and all its Frightful Consequences (in Both Sexes). Its author was aware that the sin of Onan referred to the spilling of male seed (and divine retribution for the act) but reiterated that he treated ‘of this crime in relation to women as well as men’. ‘[W]hilst the offence is Self-Pollution in both, I could not think of any other word which would so well put the reader in mind both of the sin and its punishment’. Women who indulged could expect disease of the womb, hysteria, infertility and deflowering (the loss of ‘that valuable badge of their chastity and innocence’).

Another bestselling pamphlet was published later in the century: L’onanisme (1760) by Samuel Auguste Tissot. He was critical of Onania, ‘a real chaos … all the author’s reflections are nothing but theological and moral puerilities’, but nevertheless listed ‘the ills of which the English patients complain’. Tissot was likewise fixated on ‘the physical disorders produced by masturbation’, and provided his own case study, a watchmaker who had self-pleasured himself into ‘insensibility’ on a daily basis, sometimes three times a day; ‘I found a being that less resembled a living creature than a corpse, lying upon straw, meagre, pale, and filthy, casting forth an infectious stench; almost incapable of motion.’ The fear these pamphlets promoted soon spread.

The strange thing is that masturbation was never before the object of such horror. In ancient times, masturbation was either not much mentioned or treated as something a little vulgar, not in good taste, a bad joke. In the Middle Ages and for much of the early modern period too, masturbation, while sinful and unnatural, was not invested with such significance. What changed?

Religion and medicine combined powerfully to create a new and hostile discourse. The idea that the soul was present in semen led to thinking that it was very important to retain the vital fluid. Its spilling became, then, both immoral and dangerous (medicine believed in female semen at the time). ‘Sin, vice, and self-destruction’ were the ‘trinity of ideas’ that would dominate from the 18th into the 19th century, as the historians Jean Stengers and Anne Van Neck put it in Masturbation: The Great Terror (2001).

There were exceptions. Sometimes masturbation was opposed for more ‘enlightened’ reasons. In the 1830s and 1840s, for instance, female moral campaign societies in the United States condemned masturbation, not out of hostility to sex, but as a means to self-control. What would now be termed ‘greater sexual agency’ – the historian April Haynes refers to ‘sexual virtue’ and ‘virtuous restraint’ – was central to their message.

Yet it is difficult to escape the intensity of the fear. J H Kellogg’s Plain Facts for Old and Young (1877) contained both exaggerated horror stories and grand claims: ‘neither the plague, nor war, nor smallpox, nor similar diseases, have produced results so disastrous to humanity as the pernicious habit of Onanism; it is the destroying element of civilised societies’. Kellogg suggested remedies for the scourge, such as exercise, strict bathing and sleeping regimes, compresses, douching, enemas and electrical treatment. Diet was vital: this rabid anti-masturbator was co-inventor of the breakfast cereal that still bears his name. ‘Few of today’s eaters of Kellogg’s Corn Flakes know that he invented them, almost literally, as anti-masturbation food,’ as the psychologist John Money once pointed out.

The traces are still with us in other ways. Male circumcision, for instance, originated in part with the 19th-century obsession with the role of the foreskin in encouraging masturbatory practices. Consciously or not, many US males are faced with this bodily reminder every time they masturbate. And the general disquiet unleashed in the 18th century similarly lingers on today. We seem to have a confusing and conflicting relationship with masturbation. On one hand it is accepted, even celebrated – on the other, there remains an unmistakable element of taboo.

When the sociologist Anthony Giddens in The Transformation of Intimacy (1992) attempted to identify what made modern sex modern, one of the characteristics he identified was the acceptance of masturbation. It was, as he said, masturbation’s ‘coming out’. Now it was ‘widely recommended as a major source of sexual pleasure, and actively encouraged as a mode of improving sexual responsiveness on the part of both sexes’. It had indeed come to signify female sexual freedom with Betty Dodson’s Liberating Masturbation (1974) (renamed and republished as Sex for One in 1996), which has sold more than a million copies, and her Bodysex Workshops in Manhattan with their ‘all-women masturbation circles’. The Boston Women’s Health Collective’s classic feminist text Our Bodies, Ourselves (1973) included a section called ‘Learning to Masturbate’.

Alfred Kinsey and his team are mainly remembered for the sex surveys that publicised the pervasiveness of same-sex desires and experiences in the US, but they also recognised the prevalence of masturbation. It was, for both men and women, one of the nation’s principal sexual outlets. In the US National Survey (2009–10), 94 per cent of men aged 25-29 and 85 per cent of women in the same age group said that they had masturbated alone in the course of their lifetime. (All surveys indicate lower reported rates for women.) In the just-published results of the 2012 US National Survey of Sexual Health and Behavior, 92 per cent of straight men and a full 100 per cent of gay men recorded lifetime masturbation.

There has certainly been little silence about the activity. Several generations of German university students were questioned by a Hamburg research team about their masturbatory habits to chart changing attitudes and practices from 1966 to 1996; their results were published in 2003. Did they reach orgasm? Were they sexually satisfied? Was it fun? In another study, US women were contacted on Craigslist and asked about their masturbatory experiences, including clitoral stimulation and vaginal penetration. An older, somewhat self-referential study from 1977 of sexual arousal to films of masturbation asked psychology students at the University of Connecticut to report their ‘genital sensations’ while watching those films. Erection? Ejaculation? Breast sensations? Vaginal lubrication? Orgasm? And doctors have written up studies of the failed experiments of unfortunate patients: ‘Masturbation Injury Resulting from Intraurethral Introduction of Spaghetti’ (1986); ‘Penile Incarceration Secondary to Masturbation with A Steel Pipe’ (2013), with illustrations.

‘We are a profoundly self-pleasuring society at both a metaphorical and material level’

Self-stimulation has been employed in sexual research, though not always to great import. Kinsey and his team wanted to measure how far, if at all, semen was projected during ejaculation: Jonathan Gathorne-Hardy, Kinsey’s biographer, refers to queues of men in Greenwich Village waiting to be filmed at $3 an ejaculation. William Masters and Virginia Johnson recorded and measured the physiological response during sexual arousal, using new technology, including a miniature camera inside a plastic phallus. Their book Human Sexual Response (1966) was based on data from more than 10,000 orgasms from nearly 700 volunteers: laboratory research involving sexual intercourse, stimulation, and masturbation by hand and with that transparent phallus. Learned journals have produced findings such as ‘Orgasm in Women in the Laboratory – Quantitative Studies on Duration, Intensity, Latency, and Vaginal Blood Flow’ (1985).

In therapy, too, masturbation has found its place ‘as a means of achieving sexual health’, as an article by Eli Coleman, the director of the programme in human sexuality at the University of Minnesota Medical School, once put it. A published study in the Journal of Consulting and Clinical Psychology in 1977 outlined therapist-supervised female masturbation (with dildo, vibrator and ‘organic vegetables’) as a way of encouraging vaginal orgasm. Then there is The Big Book of Masturbation (2003) and the hundreds of (pun intended) self-help books, Masturbation for Weight Loss, a Woman’s Guide only among the latest (and more opportunistic).

Self-pleasure has featured in literature, most famously in Philip Roth’s novel Portnoy’s Complaint (1969). But it is there in more recent writing too, including Chuck Palahniuk’s disturbing short story ‘Guts’ (2004). Autoeroticism (and its traces) have been showcased in artistic expression: in Jordan MacKenzie’s sperm and charcoal canvases (2007), for example, or in Marina Abramović’s reprise of Vito Acconci’s Seedbed at the Guggenheim in 2005, or her video art Balkan Erotic Epic of the same year.

On film and television, masturbation is similarly pervasive: Lauren Rosewarne’s Masturbation in Pop Culture (2014) was able to draw on more than 600 such scenes. My favourites are in the film Spanking the Monkey (1994), in which the main character is trying to masturbate in the bathroom, while the family dog, seemingly alert to such behaviour, pants and whines at the door; and in the Seinfeld episode ‘The Contest’ (1992), in which the ‘m’ word is never uttered, and where George’s mother tells her adult son that he is ‘treating his body like it was an amusement park’.

There is much evidence, then, for what the film scholar Greg Tuck in 2009 called the ‘mainstreaming of masturbation’: ‘We are a profoundly self-pleasuring society at both a metaphorical and material level.’ There are politically-conscious masturbation websites. There is the online ‘Masturbation Hall of Fame’ (sponsored by the sex-toys franchise Good Vibrations). There are masturbationathons, and jack-off-clubs, and masturbation parties.

It would be a mistake, however, to present a rigid contrast between past condemnation and present acceptance. There are continuities. Autoeroticism might be mainstreamed but that does not mean it is totally accepted. In Sexual Investigations (1996), the philosopher Alan Soble observed that people brag about casual sex and infidelities but remain silent about solitary sex. Anne-Francis Watson and Alan McKee’s 2013 study of 14- to 16-year-old Australians found that not only the participants but also their families and teachers were more comfortable talking about almost any other sexual matter than about self-pleasuring. It ‘remains an activity that is viewed as shameful and problematic’, warns the entry on masturbation in the Encyclopedia of Adolescence (2011). In a study of the sexuality of students in a western US university, where they were asked about sexual orientation, anal and vaginal sex, condom use, and masturbation, it was the last topic that occasioned reservation: 28 per cent of the participants ‘declined to answer the masturbation questions’. Masturbation remains, to some extent, taboo.

When the subject is mentioned, it is often as an object of laughter or ridicule. Rosewarne, the dogged viewer of the 600 masturbation scenes in film and TV, concluded that male masturbation was almost invariably portrayed negatively (female masturbation was mostly erotic). Watson and McKee’s study revealed that their young Australians knew that masturbation was normal yet still made ‘negative or ambivalent statements’ about it.

Belief in the evils of masturbation has resurfaced in the figure of the sex addict and in the obsession with the impact of internet pornography. Throughout their relatively short histories, sexual addiction and hypersexual disorder have included masturbation as one of the primary symptoms of their purported maladies. What, in a sex-positive environment, would be considered normal sexual behaviour has been pathologised in another. Of the 152 patients in treatment for hypersexual disorder in clinics in California, New Mexico, Pennsylvania, Texas and Utah, a 2012 study showed that most characterised their sexual disorder in terms of pornography consumption (81 per cent) and masturbation (78 per cent). The New Catholic Encyclopedia’s supplement on masturbation (2012-13), too, slips into a lengthy disquisition on sex addiction and the evils of internet pornography: ‘The availability of internet pornography has markedly increased the practice of masturbation to the degree that it can be appropriately referred to as an epidemic.’

Critics think that therapeutic masturbation might reinforce sexual selfishness rather than sexual empathy and sharing

The masturbator is often seen as the pornography-consumer and sex addict enslaved by masturbation. The sociologist Steve Garlick has suggested that negative attitudes to masturbation have been reconstituted to ‘surreptitiously infect ideas about pornography’. Pornography has become masturbation’s metonym. Significantly, when the New Zealand politician Shane Jones was exposed for using his taxpayer-funded credit card to view pornographic movies, the unnamed shame was that his self-pleasuring activities were proclaimed on the front pages of the nation’s newspapers – thus the jokes about ‘the matter in hand’ and not shaking hands with him at early morning meetings. It would have been less humiliating, one assumes, if he had used the public purse to finance the services of sex workers.

Nor is there consensus on the benefits of masturbation. Despite its continued use in therapy, some therapists question its usefulness and propriety. ‘It is a mystery to me how conversational psychotherapy has made the sudden transition to massage parlour technology involving vibrators, mirrors, surrogates, and now even carrots and cucumbers!’ one psychologist protested in the late 1970s. He was concerned about issues of client-patient power and a blinkered pursuit of the sexual climax ‘ignoring … the more profound psychological implications of the procedure’. In terms of effectiveness, critics think that therapeutic masturbation might reinforce individual pleasure and sexual selfishness rather than creating sexual empathy and sharing. As one observed in the pages of the Journal of Sex and Marital Therapy in 1995: ‘Ironically, the argument against masturbation in American society was originally religiously founded, but may re-emerge as a humanist argument.’ Oversimplified, but in essence right: people remain disturbed by the solitariness of solitary sex.

Why has what the Japanese charmingly call ‘self-play’ become such a forcing ground for sexual attitudes? Perhaps there is something about masturbation’s uncontrollability that continues to make people anxious. It is perversely non-procreative, incestuous, adulterous, homosexual, ‘often pederastic’ and, in imagination at least, sex with ‘every man, woman, or beast to whom I take a fancy’, to quote Soble. For the ever-astute historian Thomas Laqueur, author of Solitary Sex (2003), masturbation is ‘that part of human sexual life where potentially unlimited pleasure meets social restraint’.

Why did masturbation become such a problem? For Laqueur, it began with developments in 18th-century Europe, with the cultural rise of the imagination in the arts, the seemingly unbounded future of commerce, the role of print culture, the rise of private, silent reading, especially novels, and the democratic ingredients of this transformation. Masturbation’s condemned tendencies – solitariness, excessive desire, limitless imagination, and equal-opportunity pleasure – were an outer limit or testing of these valued attributes, ‘a kind of Satan to the glories of bourgeois civilisation’.

In more pleasure-conscious modern times, the balance has tipped towards personal gratification. The acceptance of personal autonomy, sexual liberation and sexual consumerism, together with a widespread focus on addiction, and the ubiquity of the internet, now seem to demand their own demon. Fears of unrestrained fantasy and endless indulging of the self remain. Onania’s 18th-century complaints about the lack of restraint of solitary sex are not, in the end, all that far away from today’s fear of boundless, ungovernable, unquenchable pleasure in the self.