Residents of Southampton are divided on the rights of migrants to live and work in Britain, new research on attitudes across the country shows.

News publisher Unherd – which surveyed more than 21,000 people in conjunction with pollster FocalData to map social attitudes across Great Britain – warned views on migration were "reshaping the British electorate", overshadowing the old economic divide between left and right-wing.

Participants were asked whether they agreed or disagreed with the statement "immigrants should be free to move to Britain and work".

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

Of the three parliamentary constituencies that are in or cross over into Southampton, the one considered the most immigrant friendly was Test – 40% agreed, compared to 35% who did not, with the rest undecided.

Of these, 18% strongly agreed with the statement, while 22% said they simply agreed.

At the other end of the scale was Romsey and Southampton North.

Here, 34% of people were pro-immigration, compared to 36% who were not.

The constituencies were ranked based on how many agree versus disagree, with the top ranking being the most pro-migrant.

Test placed 127th out of 632 constituencies – not including the 18 in Northern Ireland – while Romsey and Southampton North came in at 259th.

Across Britain as a whole, 35% of people were pro-immigration, 38% were against, and 27% were not inclined either way.

Age, education and existing ethnic diversity are key factors that influence an area's collective attitude towards immigration, according to Eric Kaufmann, Unherd commentator and professor of politics at London's Birkbeck University.

The proportion of people with a university degree closely correlates with their outlook, with more educated populations tending to be more welcoming of migrants.

London's Battersea had the most pro-immigration sentiment, with 63% backing their right to work in Britain, and just 18% disagreeing.

The area most hostile to immigrants was Clacton in Essex, where 47% of residents were against free movement.

Mr Kaufmann added: "Immigration attitudes are the fulcrum around which the politics of western societies are realigning.

"This is because those whose psychological make-up inclines them to see difference as disorder and change as loss are voting for parties that promise to slow immigration.

"Should Boris Johnson ink a [Brexit] deal while failing to reduce migration levels, we should expect this debate to return – intruding as sharply into British politics as it did in the runup to 23 June, 2016."

The results and rankings for each constituency in Southampton are:

127) Test: 40% agree, 35% disagree

254) Itchen: 37% agree, 39% disagree

259) Romsey and Southampton North: 34% agree, 36% disagree