Tajik Muslims praying. Photograph: Alexei Vladykin/AP
An atmosphere of moral panic surrounds religion. Viewed not so long ago as a relic of superstition whose role in society was steadily declining, it is now demonised as the cause of many of the world's worst evils. As a result, there has been a sudden explosion in the literature of proselytising atheism. A few years ago, it was difficult to persuade commercial publishers even to think of bringing out books on religion. Today, tracts against religion can be enormous money-spinners, with Richard Dawkins's The God Delusion and Christopher Hitchens's God Is Not Great selling in the hundreds of thousands. For the first time in generations, scientists and philosophers, high-profile novelists and journalists are debating whether religion has a future. The intellectual traffic is not all one-way. There have been counterblasts for believers, such as The Dawkins Delusion? by the British theologian Alister McGrath and The Secular Age by the Canadian Catholic philosopher Charles Taylor. On the whole, however, the anti-God squad has dominated the sales charts, and it is worth asking why.
The abrupt shift in the perception of religion is only partly explained by terrorism. The 9/11 hijackers saw themselves as martyrs in a religious tradition, and western opinion has accepted their self-image. And there are some who view the rise of Islamic fundamentalism as a danger comparable with the worst that were faced by liberal societies in the 20th century.
For Dawkins and Hitchens, Daniel Dennett and Martin Amis, Michel Onfray, Philip Pullman and others, religion in general is a poison that has fuelled violence and oppression throughout history, right up to the present day. The urgency with which they produce their anti-religious polemics suggests that a change has occurred as significant as the rise of terrorism: the tide of secularisation has turned. These writers come from a generation schooled to think of religion as a throwback to an earlier stage of human development, which is bound to dwindle away as knowledge continues to increase. In the 19th century, when the scientific and industrial revolutions were changing society very quickly, this may not have been an unreasonable assumption. Dawkins, Hitchens and the rest may still believe that, over the long run, the advance of science will drive religion to the margins of human life, but this is now an article of faith rather than a theory based on evidence.
It is true that religion has declined sharply in a number of countries (Ireland is a recent example) and has not shaped everyday life for most people in Britain for many years. Much of Europe is clearly post-Christian. However, there is nothing that suggests the move away from religion is irreversible, or that it is potentially universal. The US is no more secular today than it was 150 years ago, when De Tocqueville was amazed and baffled by its all-pervading religiosity. The secular era was in any case partly illusory. The mass political movements of the 20th century were vehicles for myths inherited from religion, and it is no accident that religion is reviving now that these movements have collapsed. The current hostility to religion is a reaction against this turnabout. Secularisation is in retreat, and the result is the appearance of an evangelical type of atheism not seen since Victorian times.
As in the past, this is a type of atheism that mirrors the faith it rejects. Philip Pullman's Northern Lights - a subtly allusive, multilayered allegory, recently adapted into a Hollywood blockbuster, The Golden Compass - is a good example. Pullman's parable concerns far more than the dangers of authoritarianism. The issues it raises are essentially religious, and it is deeply indebted to the faith it attacks. Pullman has stated that his atheism was formed in the Anglican tradition, and there are many echoes of Milton and Blake in his work. His largest debt to this tradition is the notion of free will. The central thread of the story is the assertion of free will against faith. The young heroine Lyra Belacqua sets out to thwart the Magisterium - Pullman's metaphor for Christianity - because it aims to deprive humans of their ability to choose their own course in life, which she believes would destroy what is most human in them. But the idea of free will that informs liberal notions of personal autonomy is biblical in origin (think of the Genesis story). The belief that exercising free will is part of being human is a legacy of faith, and like most varieties of atheism today, Pullman's is a derivative of Christianity.
Zealous atheism renews some of the worst features of Christianity and Islam. Just as much as these religions, it is a project of universal conversion. Evangelical atheists never doubt that human life can be transformed if everyone accepts their view of things, and they are certain that one way of living - their own, suitably embellished - is right for everybody. To be sure, atheism need not be a missionary creed of this kind. It is entirely reasonable to have no religious beliefs, and yet be friendly to religion. It is a funny sort of humanism that condemns an impulse that is peculiarly human. Yet that is what evangelical atheists do when they demonise religion.
A curious feature of this kind of atheism is that some of its most fervent missionaries are philosophers. Daniel Dennett's Breaking the Spell: Religion as a Natural Phenomenon claims to sketch a general theory of religion. In fact, it is mostly a polemic against American Christianity. This parochial focus is reflected in Dennett's view of religion, which for him means the belief that some kind of supernatural agency (whose approval believers seek) is needed to explain the way things are in the world. For Dennett, religions are efforts at doing something science does better - they are rudimentary or abortive theories, or else nonsense. "The proposition that God exists," he writes severely, "is not even a theory." But religions do not consist of propositions struggling to become theories. The incomprehensibility of the divine is at the heart of Eastern Christianity, while in Orthodox Judaism practice tends to have priority over doctrine. Buddhism has always recognised that in spiritual matters truth is ineffable, as do Sufi traditions in Islam. Hinduism has never defined itself by anything as simplistic as a creed. It is only some western Christian traditions, under the influence of Greek philosophy, which have tried to turn religion into an explanatory theory.
The notion that religion is a primitive version of science was popularised in the late 19th century in JG Frazer's survey of the myths of primitive peoples, The Golden Bough: A Study in Magic and Religion. For Frazer, religion and magical thinking were closely linked. Rooted in fear and ignorance, they were vestiges of human infancy that would disappear with the advance of knowledge. Dennett's atheism is not much more than a revamped version of Frazer's positivism. The positivists believed that with the development of transport and communication - in their day, canals and the telegraph - irrational thinking would wither way, along with the religions of the past. Despite the history of the past century, Dennett believes much the same. In an interview that appears on the website of the Edge Foundation (edge.org ) under the title "The Evaporation of the Powerful Mystique of Religion", he predicts that "in about 25 years almost all religions will have evolved into very different phenomena, so much so that in most quarters religion will no longer command the awe that it does today". He is confident that this will come about, he tells us, mainly because of "the worldwide spread of information technology (not just the internet, but cell phones and portable radios and television)". The philosopher has evidently not reflected on the ubiquity of mobile phones among the Taliban, or the emergence of a virtual al-Qaida on the web.
The growth of knowledge is a fact only postmodern relativists deny. Science is the best tool we have for forming reliable beliefs about the world, but it does not differ from religion by revealing a bare truth that religions veil in dreams. Both science and religion are systems of symbols that serve human needs - in the case of science, for prediction and control. Religions have served many purposes, but at bottom they answer to a need for meaning that is met by myth rather than explanation. A great deal of modern thought consists of secular myths - hollowed-out religious narratives translated into pseudo-science. Dennett's notion that new communications technologies will fundamentally alter the way human beings think is just such a myth.
In The God Delusion, Dawkins attempts to explain the appeal of religion in terms of the theory of memes, vaguely defined conceptual units that compete with one another in a parody of natural selection. He recognises that, because humans have a universal tendency to religious belief, it must have had some evolutionary advantage, but today, he argues, it is perpetuated mainly through bad education. From a Darwinian standpoint, the crucial role Dawkins gives to education is puzzling. Human biology has not changed greatly over recorded history, and if religion is hardwired in the species, it is difficult to see how a different kind of education could alter this. Yet Dawkins seems convinced that if it were not inculcated in schools and families, religion would die out. This is a view that has more in common with a certain type of fundamentalist theology than with Darwinian theory, and I cannot help being reminded of the evangelical Christian who assured me that children reared in a chaste environment would grow up without illicit sexual impulses.
Dawkins's "memetic theory of religion" is a classic example of the nonsense that is spawned when Darwinian thinking is applied outside its proper sphere. Along with Dennett, who also holds to a version of the theory, Dawkins maintains that religious ideas survive because they would be able to survive in any "meme pool", or else because they are part of a "memeplex" that includes similar memes, such as the idea that, if you die as a martyr, you will enjoy 72 virgins. Unfortunately, the theory of memes is science only in the sense that Intelligent Design is science. Strictly speaking, it is not even a theory. Talk of memes is just the latest in a succession of ill-judged Darwinian metaphors.
Dawkins compares religion to a virus: religious ideas are memes that infect vulnerable minds, especially those of children. Biological metaphors may have their uses - the minds of evangelical atheists seem particularly prone to infection by religious memes, for example. At the same time, analogies of this kind are fraught with peril. Dawkins makes much of the oppression perpetrated by religion, which is real enough. He gives less attention to the fact that some of the worst atrocities of modern times were committed by regimes that claimed scientific sanction for their crimes. Nazi "scientific racism" and Soviet "dialectical materialism" reduced the unfathomable complexity of human lives to the deadly simplicity of a scientific formula. In each case, the science was bogus, but it was accepted as genuine at the time, and not only in the regimes in question. Science is as liable to be used for inhumane purposes as any other human institution. Indeed, given the enormous authority science enjoys, the risk of it being used in this way is greater.
Contemporary opponents of religion display a marked lack of interest in the historical record of atheist regimes. In The End of Faith: Religion, Terror and the Future of Reason, the American writer Sam Harris argues that religion has been the chief source of violence and oppression in history. He recognises that secular despots such as Stalin and Mao inflicted terror on a grand scale, but maintains the oppression they practised had nothing to do with their ideology of "scientific atheism" - what was wrong with their regimes was that they were tyrannies. But might there not be a connection between the attempt to eradicate religion and the loss of freedom? It is unlikely that Mao, who launched his assault on the people and culture of Tibet with the slogan "Religion is poison", would have agreed that his atheist world-view had no bearing on his policies. It is true he was worshipped as a semi-divine figure - as Stalin was in the Soviet Union. But in developing these cults, communist Russia and China were not backsliding from atheism. They were demonstrating what happens when atheism becomes a political project. The invariable result is an ersatz religion that can only be maintained by tyrannical means.
Something like this occurred in Nazi Germany. Dawkins dismisses any suggestion that the crimes of the Nazis could be linked with atheism. "What matters," he declares in The God Delusion, "is not whether Hitler and Stalin were atheists, but whether atheism systematically influences people to do bad things. There is not the smallest evidence that it does." This is simple-minded reasoning. Always a tremendous booster of science, Hitler was much impressed by vulgarised Darwinism and by theories of eugenics that had developed from Enlightenment philosophies of materialism. He used Christian antisemitic demonology in his persecution of Jews, and the churches collaborated with him to a horrifying degree. But it was the Nazi belief in race as a scientific category that opened the way to a crime without parallel in history. Hitler's world-view was that of many semi-literate people in interwar Europe, a hotchpotch of counterfeit science and animus towards religion. There can be no reasonable doubt that this was a type of atheism, or that it helped make Nazi crimes possible.
Nowadays most atheists are avowed liberals. What they want - so they will tell you - is not an atheist regime, but a secular state in which religion has no role. They clearly believe that, in a state of this kind, religion will tend to decline. But America's secular constitution has not ensured a secular politics. Christian fundamentalism is more powerful in the US than in any other country, while it has very little influence in Britain, which has an established church. Contemporary critics of religion go much further than demanding disestablishment. It is clear that he wants to eliminate all traces of religion from public institutions. Awkwardly, many of the concepts he deploys - including the idea of religion itself - have been shaped by monotheism. Lying behind secular fundamentalism is a conception of history that derives from religion.
AC Grayling provides an example of the persistence of religious categories in secular thinking in his Towards the Light: The Story of the Struggles for Liberty and Rights That Made the Modern West. As the title indicates, Grayling's book is a type of sermon. Its aim is to reaffirm what he calls "a Whig view of the history of the modern west", the core of which is that "the west displays progress". The Whigs were pious Christians, who believed divine providence arranged history to culminate in English institutions, and Grayling too believes history is "moving in the right direction". No doubt there have been setbacks - he mentions nazism and communism in passing, devoting a few sentences to them. But these disasters were peripheral. They do not reflect on the central tradition of the modern west, which has always been devoted to liberty, and which - Grayling asserts - is inherently antagonistic to religion. "The history of liberty," he writes, "is another chapter - and perhaps the most important of all - in the great quarrel between religion and secularism." The possibility that radical versions of secular thinking may have contributed to the development of nazism and communism is not mentioned. More even than the 18th-century Whigs, who were shaken by French Terror, Grayling has no doubt as to the direction of history.
But the belief that history is a directional process is as faith-based as anything in the Christian catechism. Secular thinkers such as Grayling reject the idea of providence, but they continue to think humankind is moving towards a universal goal - a civilisation based on science that will eventually encompass the entire species. In pre-Christian Europe, human life was understood as a series of cycles; history was seen as tragic or comic rather than redemptive. With the arrival of Christianity, it came to be believed that history had a predetermined goal, which was human salvation. Though they suppress their religious content, secular humanists continue to cling to similar beliefs. One does not want to deny anyone the consolations of a faith, but it is obvious that the idea of progress in history is a myth created by the need for meaning.
The problem with the secular narrative is not that it assumes progress is inevitable (in many versions, it does not). It is the belief that the sort of advance that has been achieved in science can be reproduced in ethics and politics. In fact, while scientific knowledge increases cumulatively, nothing of the kind happens in society. Slavery was abolished in much of the world during the 19th century, but it returned on a vast scale in nazism and communism, and still exists today. Torture was prohibited in international conventions after the second world war, only to be adopted as an instrument of policy by the world's pre-eminent liberal regime at the beginning of the 21st century. Wealth has increased, but it has been repeatedly destroyed in wars and revolutions. People live longer and kill one another in larger numbers. Knowledge grows, but human beings remain much the same.
Belief in progress is a relic of the Christian view of history as a universal narrative, and an intellectually rigorous atheism would start by questioning it. This is what Nietzsche did when he developed his critique of Christianity in the late 19th century, but almost none of today's secular missionaries have followed his example. One need not be a great fan of Nietzsche to wonder why this is so. The reason, no doubt, is that he did not assume any connection between atheism and liberal values - on the contrary, he viewed liberal values as an offspring of Christianity and condemned them partly for that reason. In contrast, evangelical atheists have positioned themselves as defenders of liberal freedoms - rarely inquiring where these freedoms have come from, and never allowing that religion may have had a part in creating them.
Among contemporary anti-religious polemicists, only the French writer Michel Onfray has taken Nietzsche as his point of departure. In some ways, Onfray's In Defence of Atheism is superior to anything English-speaking writers have published on the subject. Refreshingly, Onfray recognises that evangelical atheism is an unwitting imitation of traditional religion: "Many militants of the secular cause look astonishingly like clergy. Worse: like caricatures of clergy." More clearly than his Anglo-Saxon counterparts, Onfray understands the formative influence of religion on secular thinking. Yet he seems not to notice that the liberal values he takes for granted were partly shaped by Christianity and Judaism. The key liberal theorists of toleration are John Locke, who defended religious freedom in explicitly Christian terms, and Benedict Spinoza, a Jewish rationalist who was also a mystic. Yet Onfray has nothing but contempt for the traditions from which these thinkers emerged - particularly Jewish monotheism: "We do not possess an official certificate of birth for worship of one God," he writes. "But the family line is clear: the Jews invented it to endure the coherence, cohesion and existence of their small, threatened people." Here Onfray passes over an important distinction. It may be true that Jews first developed monotheism, but Judaism has never been a missionary faith. In seeking universal conversion, evangelical atheism belongs with Christianity and Islam.
In today's anxiety about religion, it has been forgotten that most of the faith-based violence of the past century was secular in nature. To some extent, this is also true of the current wave of terrorism. Islamism is a patchwork of movements, not all violently jihadist and some strongly opposed to al-Qaida, most of them partly fundamentalist and aiming to recover the lost purity of Islamic traditions, while at the same time taking some of their guiding ideas from radical secular ideology. There is a deal of fashionable talk of Islamo-fascism, and Islamist parties have some features in common with interwar fascist movements, including antisemitism. But Islamists owe as much, if not more, to the far left, and it would be more accurate to describe many of them as Islamo-Leninists. Islamist techniques of terror also have a pedigree in secular revolutionary movements. The executions of hostages in Iraq are copied in exact theatrical detail from European "revolutionary tribunals" in the 1970s, such as that staged by the Red Brigades when they murdered the former Italian prime minister Aldo Moro in 1978.
The influence of secular revolutionary movements on terrorism extends well beyond Islamists. In God Is Not Great, Christopher Hitchens notes that, long before Hizbullah and al-Qaida, the Tamil Tigers of Sri Lanka pioneered what he rightly calls "the disgusting tactic of suicide murder". He omits to mention that the Tigers are Marxist-Leninists who, while recruiting mainly from the island's Hindu population, reject religion in all its varieties. Tiger suicide bombers do not go to certain death in the belief that they will be rewarded in any postmortem paradise. Nor did the suicide bombers who drove American and French forces out of Lebanon in the 80s, most of whom belonged to organisations of the left such as the Lebanese communist party. These secular terrorists believed they were expediting a historical process from which will come a world better than any that has ever existed. It is a view of things more remote from human realities, and more reliably lethal in its consequences, than most religious myths.
It is not necessary to believe in any narrative of progress to think liberal societies are worth resolutely defending. No one can doubt that they are superior to the tyranny imposed by the Taliban on Afghanistan, for example. The issue is one of proportion. Ridden with conflicts and lacking the industrial base of communism and nazism, Islamism is nowhere near a danger of the magnitude of those that were faced down in the 20th century. A greater menace is posed by North Korea, which far surpasses any Islamist regime in its record of repression and clearly does possess some kind of nuclear capability. Evangelical atheists rarely mention it. Hitchens is an exception, but when he describes his visit to the country, it is only to conclude that the regime embodies "a debased yet refined form of Confucianism and ancestor worship". As in Russia and China, the noble humanist philosophy of Marxist-Leninism is innocent of any responsibility.
Writing of the Trotskyite-Luxemburgist sect to which he once belonged, Hitchens confesses sadly: "There are days when I miss my old convictions as if they were an amputated limb." He need not worry. His record on Iraq shows he has not lost the will to believe. The effect of the American-led invasion has been to deliver most of the country outside the Kurdish zone into the hands of an Islamist elective theocracy, in which women, gays and religious minorities are more oppressed than at any time in Iraq's history. The idea that Iraq could become a secular democracy - which Hitchens ardently promoted - was possible only as an act of faith.
In The Second Plane, Martin Amis writes: "Opposition to religion already occupies the high ground, intellectually and morally." Amis is sure religion is a bad thing, and that it has no future in the west. In the author of Koba the Dread: Laughter and the Twenty Million - a forensic examination of self-delusion in the pro-Soviet western intelligentsia - such confidence is surprising. The intellectuals whose folly Amis dissects turned to communism in some sense as a surrogate for religion, and ended up making excuses for Stalin. Are there really no comparable follies today? Some neocons - such as Tony Blair, who will soon be teaching religion and politics at Yale - combine their belligerent progressivism with religious belief, though of a kind Augustine and Pascal might find hard to recognise. Most are secular utopians, who justify pre-emptive war and excuse torture as leading to a radiant future in which democracy will be adopted universally. Even on the high ground of the west, messianic politics has not lost its dangerous appeal.
Religion has not gone away. Repressing it is like repressing sex, a self-defeating enterprise. In the 20th century, when it commanded powerful states and mass movements, it helped engender totalitarianism. Today, the result is a climate of hysteria. Not everything in religion is precious or deserving of reverence. There is an inheritance of anthropocentrism, the ugly fantasy that the Earth exists to serve humans, which most secular humanists share. There is the claim of religious authorities, also made by atheist regimes, to decide how people can express their sexuality, control their fertility and end their lives, which should be rejected categorically. Nobody should be allowed to curtail freedom in these ways, and no religion has the right to break the peace.
The attempt to eradicate religion, however, only leads to it reappearing in grotesque and degraded forms. A credulous belief in world revolution, universal democracy or the occult powers of mobile phones is more offensive to reason than the mysteries of religion, and less likely to survive in years to come. Victorian poet Matthew Arnold wrote of believers being left bereft as the tide of faith ebbs away. Today secular faith is ebbing, and it is the apostles of unbelief who are left stranded on the beach.
· John Gray's Black Mass: Apocalyptic Religion and the Death of Utopia will be out in paperback in April (Penguin)