In June 1847 John Stuart Mill sent a long and thoughtful letter to a London weekly paper called The Reasoner and Herald of Progress. The Reasoner was edited by George Jacob Holyoake, a working-class Chartist who had become a celebrity five years earlier when he was sentenced to six months in prison for “condemning Christianity”. After his release Holyoake set up the Reasoner to provide the people of Britain with a militant “journal of freethought”, and he went on to coin the term “secularist” to describe his political creed. By the time of his death in 1907, when he was nearly 90 years old, he was revered as a leading architect of the National Secular Society and the Rationalist Press Association. He was, you might say, the godfather of modern British humanism.

Gary Neill's illustration of JS Mill for Jonathan Rée's articleBack in 1847, Holyoake was in financial trouble. The Reasoner was losing money, and he was obliged to appeal for subscriptions to pay off his creditors. John Stuart Mill – a radical journalist in his early 40s, and a logician and economist as well as a self-styled “infidel” and a respected public servant (he had been toiling away at the East India Company since the age of 17) – had no hesitation in making a contribution to Holyoake’s fund. “I should much regret,” as he put it in his letter, “that the flag of avowed unbelief, unfurled by the Reasoner alone among English periodical writings, should be lowered for want of the support necessary for keeping it flying.”

But Mill’s support had a sting in its tail. “My goodwill to the Reasoner,” he continued, “does not arise from my thinking it at all an adequate representative of either the argumentative or the moral strength of enlightened infidelity.” Holyoake, like most other “infidel writers”, made a habit of lamenting the “immorality” of the old priest-ridden world, as if morality were in itself a source of unimpeachable intuitions that secularists could adopt for their own use without a second thought. From Mill’s point of view, however, morality as it actually existed was little more than a ramshackle collection of prejudices, shot through with theological dogma, and instinctively conservative, clannish and cruel. “Mankind have, as a race, hitherto grounded their morality mainly on religion,” Mill wrote; “and if their religion is false it would be very extraordinary that their morality should be true.”

In particular, religion had poisoned the wells of morality by suggesting that we must love our neighbours not for their sake but for our own – that good-heartedness should be regarded not as the spontaneous fruit of well-being but as a sacrifice made by prudent people in the expectation of being infinitely recompensed in a future life. Freethinkers should stop trying to step into the pulpit of the old morality, Mill said, and set to work devising a “better, juster, nobler set of moral principles and rules than those generally received” – a morality purged of selfishness, smugness and supernaturalism and reduced to a scientific estimate of the interests of humanity as a whole.

To Mill’s regret, the editor of the Reasoner had more appetite for metaphysical argument than for moral reform. Holyoake was obsessed with disproving the existence of God and dancing on the grave of the defunct deity – an entirely pointless exercise, as far as Mill was concerned, since the question of God’s existence was “a matter of hypothesis and conjecture”, beyond either proof or disproof. No amount of rational argument was going to dislodge the convictions of those who wished to see the world as having a divine origin, and freethinkers would be better advised to dwell on the fact that, if the world is indeed a result of deliberate design, then its creator must have been grossly incompetent. The “author of nature”, if there was one, was either unjust, malicious and rather stupid, or else “hemmed in by obstacles” and overwhelmed by the course of events – an object for contempt or pity rather than love, emulation or worship. “Mankind,” Mill concluded, “can scarcely chuse [sic] to themselves a worse model of conduct.”

Holyoake took Mill’s money but not his advice. He didn’t even make space in his pages for what might be considered a rather interesting letter from a rather distinguished correspondent; and Mill seems to have become disheartened in his campaign for enlightened infidelity. The remaining 25 years of his gloriously productive life were devoted to various radical causes – notably the fight for women’s rights – but on the whole he confined his thoughts on religion to personal letters and a private diary.

Not that he wanted to make a secret of his opinions. In 1865 he published an impressive study of the French philosopher Auguste Comte, and despite condemning the “palpable absurdities” of Comte’s grandiose system of Positivism, he endorsed the all-encompassing doctrine that science is destined to vanquish both theology and metaphysics. He also expressed sympathy for Comte’s project for a post-theological and post-metaphysical form of religion – “religion without a God” or the “Religion of Humanity” – that would celebrate the infinite glories not of a heavenly creator but of the “Human Race” as such, or, as Mill preferred to put it, of “all sentient beings”. And if God should turn out to exist after all, so much the worse for him. “I will call no being good, who is not what I mean when I apply that epithet to my fellow creatures,” as Mill put it; “and if such a being can sentence me to hell for not so calling him, to hell I will go.”

To hell I will go: within weeks the phrase had ricocheted all round the world, and Mill, who was then embarking on a brief career as a Member of Parliament, soon found himself being denounced in press and pulpit as an atheist, even a Satanist. He did not rise to the bait, however, and it was not till after he died – in 1873, at the age of 66 – that the world received a full account of his attitude to religion. First there was the posthumous Autobiography, in which he explained, without exaggeration, that he was almost unique amongst the unbelievers of his generation, in that he “had not thrown off religious belief, but never had it.” The Autobiography is a marvellous book, and justly famous; but unfortunately its brilliance obscured the excellence of his other posthumous book – the Three Essays on Religion that appeared a few months later.

Three Essays begins with an exemplary analysis of the idea of nature, demonstrating that “naturalness” should never be regarded as a source or a standard of moral value: we have only one duty towards nature, Mill argues – “namely not to follow it but to amend it.” He goes on, in the second essay, to discuss the possibility that “religion may be morally useful without being intellectually sustainable.” There could be no doubt, of course, that religion has a certain ghastly utility as a cache of imaginary inducements to righteousness – “a supplement to human laws, a more cunning sort of police, an auxiliary to the thief-catcher and the hangman.” On the other hand, morality was bound to stagnate as soon it was fitted out with a supernatural pedigree: it became sanctified and fetishised and thus removed from any possibility of criticism, let alone reform; hence religion had to be marked down as a moral disaster after all.

In the last part of Three Essays Mill undertook a calm and open-minded assessment of the probability of theism. Revelation, miracles and immortality are dispatched very swiftly, along with the idea of a “first cause”, but the argument from design is treated with considerable respect. There were certain natural phenomena, Mill found, that lent credibility to the hypothesis of an “intelligent origin” – specifically, those where organisation emerges amongst numerous different elements, almost as if they were all “conspiring to an end”.

How, after all, could a bunch of cells with a rudimentary sensitivity to light evolve into an eye unless they were somehow predisposed towards the higher purposes of vision? Mill acknowledged that Darwin’s account of natural selection – though a relatively untried novelty at the time he was writing – might help fill the explanatory gap; but no one, not even Darwin, could claim that natural selection was “inconsistent with Creation”. Religious believers could not draw any comfort, however: the evidence for “creation by intelligence” pointed not to a wise, powerful and benevolent deity but to a finite and amoral power that was frequently baffled and outwitted by the unbiddable forces of nature. Even if certain parts of the natural world have a designer, Mill concluded, “the notion of a providential government by an omnipotent being for the good of his creatures must be entirely dismissed.”

Mill closed his final book with a charming riff about the power of hope. As a general rule, he says, we ought to adjust our opinions to the available evidence, however depressing or disturbing it may be. But when it comes to the imagined future, “the literal truth of facts is not the only thing to be considered.” A “cheerful disposition” is always preferable to depression, or to what Mill called (on the basis of personal experience) “the disastrous feeling of ‘not worth while’.” We all have a right, he says, to “the indulgence of hope”, and – hopefulness being in itself a force for the good – it should perhaps be regarded as a duty as well as a right.

Mill’s Three Essays belongs on any shortlist of the towering classics of secularist thought; but it has never yet been given its due. We must therefore be cheered by its appearance in a neat and friendly volume that every one of us would want to have on our bookshelves. And the fact that the essays are supplemented in this edition by a splendid introduction from Louis Matz, and a generous selection from Mill’s other writings on religion, is yet another motive for good cheer.

Three Essays on Religion by John Stuart Mill, edited by Louis J Matz, is published by Broadview Press