As he lay dying in the spring of 1832, the great philosopher Jeremy Bentham left detailed directions for the preservation of his corpse. First, it was to be publicly dissected in front of an invited audience. Then, the preserved head and skeleton were to be reassembled, clothed, and displayed "in the attitude in which I am sitting when engaged in thought and writing". His desire to be preserved forever was a political statement. As the foremost secular thinker of his time, he wanted to use his body, as he had his mind, to defy religious superstitions and advance real, scientific knowledge. Almost 200 years later, Bentham's "auto-icon" still sits, staring off into space, in the cloisters of University College London.

Nowadays Bentham is hardly a household name. Yet his ideas have proved extraordinarily influential in law, economics, philosophy and politics. Among other things, he was the inventor of the modern doctrine of utilitarianism, the foundational theorist of legal positivism, and the first exponent of cost-benefit analysis. If you've ever weighed up the pros and cons of doing something, you're treading in his footsteps.

In his own time he was celebrated around the globe. Countless practical efforts at social and political reform drew inspiration from him and his disciples (the most famous of whom was John Stuart Mill). From the 1790s on, in Britain, France, Spain, Portugal, Greece and across Latin America, liberal governments and politicians sought his advice and assistance. He was made an honorary citizen of revolutionary France, while the Guatemalan leader José del Valle acclaimed him as "the legislator of the world". Never before or since has the English-speaking world produced a more politically engaged and internationally influential thinker across such a broad range of subjects. The first constitutions of the independent republic of Colombia owed as much to Bentham as do modern theories of animal rights.

After his death, the keepers of his memory invariably sought to portray him as a man whose intellect and concern for the public good were so all‑consuming that there had been no place for sexual passion in his life. As Mill put it, "knowing so little of human feelings, he knew still less of the influences by which those feelings are formed": even in his 80s, "he was a boy". Leslie Stephen thought him "all his life both a philosopher and a child … he was not only never in love, but looks as if he never talked to any woman except his cook and housemaid".

This was a travesty of the truth. In his 20s, Bentham fell deeply in love with Polly Dunkley, the orphaned daughter of an Essex doctor. He wanted to marry her, but because she didn't have enough money, his rich and overbearing father prevented it, and after several years their relationship came to an end. Later in life, after his father's death had made him independently wealthy, Bentham loved and proposed marriage to the clever and radical young aristocrat Caroline Fox, niece of the Whig leader Charles James Fox. When the vivacious Irish painter Amelia Curran, a friend of the Shelleys, came to paint Bentham in the early 1810s, the two of them appear to have had some kind of entanglement. And among his surviving manuscripts are some remarkable notes on sexual techniques, toys and positions whose explicitness would have made Mill blush.

Bodily passion was not just a part of Bentham's life: it was fundamental to his thought. After all, the maximisation of pleasure was the central aim of utilitarian ethics. In place of the traditional Christian stress on bodily restraint and discipline, Bentham sought, like many other 18th-century philosophers, to promote the benefits of economic consumption, the enjoyment of worldly appetites and the liberty of natural passions. This modern, enlightened view of the purpose of life spawned a revolution in sexual attitudes, and no European scholar of the time pursued its implications as thoroughly as Bentham. To think about sex, he noted in 1785, was to consider "the greatest, and perhaps the only real pleasures of mankind": it must therefore be "the subject of greatest interest to mortal men". Throughout his adult life, from the 1770s to the 1820s, he returned again and again to the topic. Over many hundreds of pages of private notes and treatises, he tried to strip away all the irrational and religious prohibitions that surrounded sexual activity.

Of all enjoyments, Bentham reasoned, sex was the most universal, the most easily accessible, the most intense, and the most copious – nothing was more conducive to happiness. An "all-comprehensive liberty for all modes of sexual gratification" would therefore be a huge, permanent benefit to humankind: if consenting adults were freed to do whatever they liked with their own bodies, "what calculation shall compute the aggregate mass of pleasure that may be brought into existence?"

The main impetus for Bentham's obsession with sexual freedom was his society's harsh persecution of homosexual men. Since about 1700, the increasing permissiveness towards what was seen as "natural" sex had led to a sharpened abhorrence across the western world of supposedly "unnatural" acts. Throughout Bentham's lifetime, homosexuals were regularly executed in England, or had their lives ruined by the pillory, exile or public disgrace. He was appalled at this horrible prejudice. Sodomy, he argued, was not just harmless but evidently pleasurable to its participants. The mere fact that the custom was abhorrent to the majority of the community no more justified the persecution of sodomites than it did the killing of Jews, heretics, smokers, or people who ate oysters – "to destroy a man there should certainly be some better reason than mere dislike to his Taste, let that dislike be ever so strong".

Though ultimately he never published his detailed arguments for sexual liberty for fear of the odium they would bring on his general philosophy, Bentham felt compelled to think them through in detail, to write about them repeatedly and to discuss them with his acquaintances. In one surviving letter to a friend, he joked that his rereading of the Bible had finally revealed that the sin for which God had punished the inhabitants of Sodom and Gomorrah was not in fact buggery, but the taking of snuff. He and his secretary had consequently taken a solemn oath to hide their snuff-pouches and nevermore to indulge "that anti-Christian and really unnatural practice" in front of one another. Meanwhile, they were now both happily free to enjoy "the liberty of taking in the churchyard or in the market place, or in any more or less public or retired spot with Man, Woman or Beast, the amusement till now supposed to be so unrighteous, but now discovered to be a matter of indifference". Among those with whom Bentham discussed his arguments for sexual toleration were such influential thinkers and activists as William Godwin, Francis Place and James Mill (John Stuart Mill's father). Bentham's ultimate hope, "for the sake of the interests of humanity", was that his private elaboration and advocacy of these views might contribute to their eventual free discussion and general acceptance. "At any rate," he once explained, even if his writings could not be published in his own lifetime, "when I am dead mankind will be the better for it".

Yet after Bentham's death his voluminous manuscripts on sex disappeared. His Victorian editor hid them from the public. Even after his papers were deposited at UCL, and a huge project was begun to publish a modern edition of his works, his sexual writings remained unknown. In 1931, the polymath CK Ogden printed some brief extracts, and in the 1970s and 1980s, Louis Crompton, an American scholar of gay history, and Lea Campos Boralevi, an Italian feminist who wrote the first major study of Bentham's views on women and sex, both published books that showed how radical his views were. But the official Bentham Project largely ignored this aspect of his thinking. That neglect is all the more surprising given that for many years the project's director was the philosopher HLA Hart, a noted advocate for the decriminalisation of homosexuality. Had Bentham's arguments been published under his editorship in the 1960s, they might have made a real contribution to current political and legal debates. These days, by contrast, they are mainly of historical interest.

Unfortunately this volume makes only a partial start on the work that is really needed. Only three of Bentham's documents from the 1810s are printed, and none of his many other texts on the subject is included or even cross‑referenced, so that the development and full range of his thoughts on sex are impossible to trace. Beyond a few general remarks we are left in the dark about the significance and originality of Bentham's sexual ideas, and their relationship to the intellectual currents of his time. Still, it is a notable event. Bentham was the first major English philosopher of sexual liberty, and it's about time we celebrated that. "If there be one idea more ridiculous than another," he once wrote about the sexual prohibitions of his day, it was that "of a legislator who, when a man and a woman are agreed about a business of this sort, thrusts himself in between them, examining situations, regulating times, and prescribing modes and postures". Today we are all the heirs of this once revolutionary way of thinking. So, the next time you try out any new modes or postures in the privacy of your bedroom, do take a moment to salute him.

• Faramerz Dabhoiwala's The Origins of Sex: A History of the First Sexual Revolution is out in paperback from Penguin. To order Of Sexual Irregularities with free UK p&p call Guardian book service on 0330 333 6846 or go to guardianbookshop.co.uk.