Test Valley contains some of the least religious areas in Britain, according to a survey of social attitudes.

A survey of 21,000 people carried out by the publisher UnHerd and pollster FocalData has uncovered deep religious divides between city and country, with diverse urban areas home to stronger religious sentiments.

Participants were asked whether they agreed or disagreed with the statement “all morals are grounded in religious teachings”, which UnHerd said may correspond to strength of religious feeling.

The responses were then analysed to create a model for each constituency based on the demographics of their populations.

Of the two constituencies that are in or cross over into Test Valley, the most religious was North West Hampshire – 26% agreed that religion was the basis of morality, compared to 40% who did not, with the rest undecided.

Of these, 16% strongly disagreed with the statement, while 26% said they simply disagreed.

The constituencies were ranked based on how many agreed versus disagreed, with UnHerd linking a higher ranking to more widespread religious belief.

North West Hampshire placed 424th out of 632 constituencies – not including the 18 constituencies in Northern Ireland.

In the constituency of Romsey and Southampton North, meanwhile, 23% of people backed the moral authority of religion, compared to 42% who did not – placing it at 608th nationwide.

Across Britain, 34% of people agreed with the statement while 32% disagreed, with the rest undecided.

Westminster North in London came in at number one, with 41% agreeing with the statement, and just 29% disagreeing.

The area with the least faith was Edinburgh South, where 23% of residents agreed compared to 49% who disagreed.

Canon Giles Fraser, rector at St Mary’s Church in London’s Newington, said it was “no surprise” that faith was more rigorous in cities, especially those heavily shaped by immigration.

This is partly responsible for the more rapid decline in Christian congregations in rural areas, he said, while immigration from former colonies returned Christianity “back to the places that first sponsored its evangelisation”.

He continued: “One familiar explanation for the religiosity of migrants is that faith is a way of maintaining a connection with the places and culture from which people have travelled.

“There may be something to this, but the bigger story is surely that the world is a much more religious place than the western secular imagination often recognises.

“If Brexit happens, and the UK is forced to face more towards a world outside of Europe, it will be engaging with a world that is far more religious than it is used to and perhaps comfortable with.”