Media playback is unsupported on your device Media caption David Cameron: "There are people who... buy into some of these prejudices, giving the extreme Islamism narrative weight and telling fellow Muslims, 'You are part of this'"

David Cameron's attack on Islamic extremism at this month's Slovakia security conference included the charge that groups such as Islamic State believe "religious doctrine trumps the rule of law".

The phrase is revealing in a way the prime minister probably did not intend: it underlines how far the role of religion has been eroded in British life.

For most of our history, most people in this country would have taken it for granted that God's laws should trump those made by man - indeed they would have assumed that "religious doctrine" provided the proper basis for "the rule of law".

Take Magna Carta, which we have heard so much about recently.

In the Preamble, King John states that he is accepting limits to his power "having regard to God and for the salvation of our soul, and those of all our ancestors and heirs, and unto the honour of God and the advancement of his holy Church" and he acknowledges that he is acting on the advice of "our venerable fathers" the bishops.

So this cornerstone of law and liberty was explicitly laid on religious foundations.

Anglicanism 'disappearing'

The idea of an inherent conflict between law and religion is a very modern one.

But then Mr Cameron leads a country where religious faith, in particular as expressed through the established Church, is in precipitous decline.

Image caption Could churches in Britain be empty in 20 years' time?

The Spectator recently published a cover story about what it called "the death rattle" of Christianity in Britain, in which the Catholic journalist Damian Thompson speculated that "Anglicanism will disappear from Britain in 2033".

He cites British Social Attitudes surveys, which suggest that the number of Anglicans here "fell from 40% of the population in 1983 to 29% in 2004 to 17% last year".

The decline among Roman Catholics is less marked - from 10% of the population to 8% over the same period - but Mr Thompson puts that down to immigration.

It used to be thought that the United States was immune to this kind of secularisation, but a survey published by the Washington-based Pew Foundation last month calls that into question.

It found that the percentage of Americans who described themselves as Christian had dropped from 78.4% to 70.6% between 2007 and 2014.

And while those figures of course show that America is still an overwhelmingly Christian country, the Pew Religious Landscape Survey also suggests that the decline is a trend. It concludes that "the drop in religious affiliation is particularly pronounced among young adults".

Distribution of Christian population by region

Americas: 804 million

Europe: 566 million

Sub-Saharan Africa: 516 million

Asia-Pacific: 285 million

Middle East-North Africa: 13 million

Source: Pew Research Center's Forum on Religion & Public Life, estimates for 2010

Religious boom in Asia

Image copyright Getty Images Image caption China's Christian population is growing

Contrast that to what is happening in, for example, China, where a Pew study put the number of Christians at 67 million in 2010 - a huge increase from the one million or so when Communist rule was established in 1949.

Tracking Christianity's growth in China is difficult (not least because many Christians are still reluctant to admit their affiliation), but it is widely thought that the number of Chinese Christians now exceeds the number of Communist Party members.

Some projections suggest that China will have the largest Christian population in the world (some 250 million) by about 2030 - so at about the moment when the Church of England will, if the Spectator is right, expire altogether.

What's behind the growth in Christianity in China is open to interpretation. The power of the Gospel? Filling a vacuum left by the collapse of faith in communism? Wicked manipulation by the running-dogs of capitalism? Your explanation will depend on who you are.

But this is all the more remarkable because since the 19th Century, Christianity has been closely associated in Chinese culture with unwelcome meddling by foreign powers, and it suggests - at a minimum - that societies do not automatically become more secular as they become richer.

Elsewhere in Asia, religion is booming too, and not always in a benign manner.

In India, something as apparently non-controversial as last week's International Yoga Day became a source of religious tension, with some Muslims accusing the government of pursuing a divisive pro-Hindu agenda. Meanwhile, Sri Lanka and Burma have seen the rise of intolerant and nationalist Buddhism, a bewildering development for many in the West.

And the overwhelming - and often malign - power of religion in the Middle East is of course all too apparent.

'Altruistic evil'

In the week of David Cameron's Slovakia speech, the former Chief Rabbi, Jonathan Sacks, published a book which makes an explicit link between the extremism that concerns the prime minister and the growing gulf between a secular West and a religious world.

Image caption Lord Sacks believes the world will be more religious in the coming decades

In the West, Lord Sacks argues, "the old marriage of religion and culture has ended in divorce". Our societies offer no clear values that appeal to young people looking for meaning, so religiously minded youths turn to the world beyond our borders where religion remains such a compelling force.

And very often radical Islam offers, as Lord Sacks told us on BBC Radio 4's Sunday programme, "the sharpest, clearest voices they are hearing". He has coined the term "altruistic evil" to describe the phenomenon of profoundly evil acts committed for idealistic motives.

It is persuasive analysis. Of course the West has powerful values to offer, but they are largely "post-religious"; tolerance and democracy involve respecting the opinions and feelings of others, a more complex and less obviously dynamic process than the kind of message projected by those Mr Cameron called the "firebrand preachers online".

And this is why it matters. If you live within a secular society, it is easy to assume that religions will simply wither away, but Lord Sacks offers the opposite view.

"The world will be more religious a generation from now, not less," he says. "The more religious people are, the more children they have. The more secular they are, the fewer children they have... the religious will inherit the Earth."

For more on this story, listen to BBC Radio 4's Sunday on iPlayer or download the podcast.