Prejudice against immigrants from the European Union was a “major” deciding factor in the Brexit referendum, according to a new study.

But people who actually met foreigners living in Britain tended to have a positive experience and this appears to have helped persuade many people to vote Remain, the researchers found.

The results suggest that the Brexit campaign’s emphasis on immigration – dubbed “Project Hate” by the pro-EU camp – was politically astute.

One pro-Leave poster – showing a line of refugees with the headline “Breaking Point, the EU has failed us all” and urging people to “take back control of our borders” – was compared to Nazi propaganda. Ukip said it “utterly rejects the association”.

After the referendum, police reported a tripling of hate crimes in some of the most Eurosceptic parts of the UK.

The lead researcher of the new study, Dr Rose Meleady, said their findings helped explain an apparently counter-intuitive voting pattern – that areas with low numbers of immigrants were more likely to back Brexit.

“It is the contact that predicts prejudice towards immigrants, and prejudice was a predictor of how people intended to vote,” she said.

“Everyday interactions with immigrants are really important. If you have more opportunities for contact, for example on public transport, at the shops, or with neighbours and colleagues, your attitude is likely to be more positive.

“Fear of immigration can sometimes drive prejudice rather than its reality.”

In pictures: European parliament Brexit discussions Show all 12 1 /12 In pictures: European parliament Brexit discussions In pictures: European parliament Brexit discussions European commission member in charge of Brexit negotiations with Britain, French Michel Barnier listens at the President of the European Commission Jean-Claude Juncker speaking at the European Parliament in Strasbourg Getty Images In pictures: European parliament Brexit discussions Frank-Walter Steinmeier, President of the Federal Republic of Germany, delivers his speech at the European Parliament in Strasbourg EPA In pictures: European parliament Brexit discussions European Union's chief Brexit negotiator Guy Verhofstadt, President of the Group of the Alliance of Liberals and Democrats for Europe (ALDE), addresses the European Parliament during a debate on Brexit priorities and the upcomming talks on the UK's withdrawal from the EU Reuters In pictures: European parliament Brexit discussions Michel Barnier, European Chief Negotiator for Brexit reacts during a meeting at the European Parliament in Strasbourg EPA In pictures: European parliament Brexit discussions Member of the European Parliament and former leader of the anti-EU UK Independence Party (UKIP) Nigel Farage wears socks with Union Jack flag at the European Parliament in Strasbourg Getty Images In pictures: European parliament Brexit discussions Nigel Farage, United Kingdom Independence Party (UKIP) member and MEP, addresses the European Parliament during a debate on Brexit priorities and the upcoming talks on the UK's withdrawal from the EU Reuters In pictures: European parliament Brexit discussions European commission member in charge of Brexit negotiations with Britain, French Michel Barnier gestures during speeches at the European Parliament in Strasbourg Getty In pictures: European parliament Brexit discussions The President of the European Commission Jean-Claude Juncker (L) speaks with European commission member in charge of Brexit negotiations with Britain, French Michel Barnier at the European Parliament in Strasbourg Getty In pictures: European parliament Brexit discussions European Union's chief Brexit negotiator Guy Verhofstadt, President of the Group of the Alliance of Liberals and Democrats for Europe (ALDE), addresses the European Parliament during a debate on Brexit priorities and the upcomming talks on the UK's withdrawal from the EU Reuters In pictures: European parliament Brexit discussions Member of the European Parliament and former leader of the anti-EU UK Independence Party (UKIP) Nigel Farage gestures during speeches at the European Parliament in Strasbourg, eastern France, on April 5, 2017. The European Parliament will on April 5 lay down its "red lines" for negotiations over a Brexit deal, on which the assembly will have the final say in two years' time. / AFP PHOTO / Sebastien BozonSEBASTIEN BOZON/AFP/Getty Images Getty In pictures: European parliament Brexit discussions German president Frank-Walter Steinmeier delivers a speech during a plenary session at the European Parliament in Strasbourg Getty In pictures: European parliament Brexit discussions The European Parliament in Strasbourg, eastern France Getty Images

Shortly before the referendum, the researchers recruited 417 people who were planning to vote and asked them a series of questions about their views. A psychological measure known as a “feeling thermometer” was used to assess how cold or warm they felt towards immigrants.

Support for Brexit correlated more closely with dislike of foreigners than several other factors.

Prejudice was found to have a correlation score with voting Leave of 0.51 on a scale from zero, meaning no relationship, to one, meaning the two factors matched exactly.

This was a bigger factor than holding politically conservative views (0.43), having negative contact with immigrants (0.43) and being older (0.15).

In contrast, voting Remain was associated with positive contact with immigrants (0.4) and being more educated (0.17). Gender did not have a statistically significant effect.

Dr Meleady, of the University of East Anglia, said the figures showed prejudice against EU immigrants was a “major” deciding factor in the referendum, but it was unclear whether this would have swayed the result.

She said their findings showed the importance of policies that encouraged different groups to meet each other.

“Of course, interactions can sometimes be unpleasant or unfriendly and this can increase negative feelings, but we find that people report more positive encounters with immigrants than negative,” she added.