When my girlfriend and I were in London last week, a drunk man accosted us at a pub. That’s pretty par for the course there, in my experience. But this one — a middle-aged, dark-haired white guy we’ll call "Bob" — was different. He didn’t want to talk about soccer, or real ale, or his feelings on Americans.

No, Bob wanted to talk about Brexit — the UK referendum that, we all now know, ended in Britain voting to leave the European Union. Bob wanted Britain to leave, and he was very open about his reason: immigration. The Muslims and the Eastern Europeans, he believes, are ruining Great Britain.

"We’re letting in rapists. We’re letting in shit," Bob told us repeatedly. "I have four children. How are they supposed to get jobs?"

This scene wasn't unique. It played itself out in thousands of pubs across the United Kingdom, and we've seen the results. Britain’s Bobs were the driving force behind the successful "Leave" campaign. And the force that's been driving them is xenophobia.

Britain is experiencing an immigration surge

To understand why Brexit is, at its heart, about immigration, you need to understand a little about the history of immigration to Britain.

Before the European Union was created in 1993, immigration wasn’t a huge deal in the UK. Net migration — the number of people who move to the UK minus the number of people who move out of it — was less than 100,000 annually. After that, however, things changed.

"Between 1993 and 2014 the foreign-born population in the UK more than doubled from 3.8 million to around 8.3 million," Oxford researchers Cinzia Rienzo and Carlos Vargas-Silva write. "During the same period, the number of foreign citizens increased from nearly 2 million to more than 5 million."

This can’t all be laid at the EU’s feet. India and Pakistan are the first and third largest sources of British immigration, respectively. But the EU played a major part, as its rules restrict the ability of member states to bar migration from other EU member states.

Between 2004 and 2014, when immigration to the UK really took off, the percentage of migrants entering the UK from Europe spiked. It went from a little over 25 percent to a little under 50 percent, which means that Europe has driven a lot of the recent rise in the UK’s immigrant population.

There are basically two reasons for this. First, the EU starting expanding in 2004 to include mostly post-communist countries in central and Eastern Europe. These countries are poorer, which means that when they acceded to the EU, their citizens were more likely to move out of them to find work in richer countries such as the UK. Indeed, Poland is now the second-largest source of immigrants to the UK, just behind India.

These "accession" countries were a major driver of European immigration to Britain in the past decade, as this chart from Oxford’s Migration Observatory shows:

Second, the 2008 financial collapse and subsequent eurozone crisis impoverished some historically wealthier countries such as Spain, Italy, and Portugal. As unemployment rose in those countries, their citizens started to look to other EU nations for employment opportunities. The British labor market was relatively easy to break into, and lots of people across Europe speak English, so it was a natural target for these southern Europeans.

This, together with the continued influx of people from the "accession" states, resulted in the number of EU-born people living in the UK reaching over 3 million by 2015.

It also resulted in the EU becoming inextricably linked with immigration in the minds of a lot of Brits. They weren’t used to mass immigration, but since joining the EU they’ve been getting a whole lot of it. And not all of Britain’s citizens, as it turns out, are happy about this state of affairs.

Anti-immigrant backlash is driving support for Brexit

Xenophobia exists in basically every country on Earth. The UK is no exception: Polling data shows high levels of hostility to immigrants going back decades before mass immigration began. But the huge increase in immigration in the past 20 years made this sentiment politically potent, fueling an anti-immigrant backlash.

Over the course of the past 20 years, the percentage of Britons ranking "immigration/race relations" as among the country’s most important issues has gone from near zero percent to about 45 percent. Seventy-seven percent of Brits today believe that immigration levels should be reduced.

As a result, anti-immigrant demagoguery has become politically potent. The UK Independence Party (UKIP), led by a Donald Trump–style populist demagogue named Nigel Farage, began life as an irrelevant anti-EU party in the early '90s. But in the past 10 years, UKIP’s poll numbers have soared: It got 4 million votes in the 2015 election, the third-largest national vote total in the country.

UKIP has done this by focusing, obsessively, on the threat from immigrants, both from inside the EU and out. Muslims are a favorite Farage bugaboo. Since the European migrant crisis began, he has warned that EU membership will force the UK to let in large numbers of Muslim refugees.

"There is an especial problem with some of the people who’ve come here and who are of the Muslim religion who don’t want to become part of our culture," Farage said in a 2015 interview. "People do see a fifth column living within our country, who hate us and want to kill us."

But UKIP is also perfectly happy to target non-Muslim EU immigrants, particularly those from Eastern Europe. UKIP treats these people essentially the way Trump treats Mexicans: blasting them, as our new pub friend Bob had, as criminals stealing British jobs.

In 2014, for example, Farage warned of a "Romanian crime wave" in the UK. He has also proposed a law that would allow British employers to discriminate against non-Brits in hiring, calling for "British jobs for British workers."

At the same time, the center-right Conservative Party has also grown more hostile to the EU and the increased immigration it represents, out of both genuine conviction and a sense that catering to anti-European sentiment is good politics. Conservative Prime Minister David Cameron, who supports remaining in the EU, is opposed by about half of his own party’s members of Parliament. Perhaps the most famous Leave supporter, aside from Farage, is Boris Johnson, the Conservative former mayor of London.

Farage and the Johnson flank of the Conservative Party are the reason Brexit happened.

Because they believe (correctly) that Britain can’t radically reduce immigration without leaving the EU, pushing Brexit became one of their top priorities. As immigration has grown, so has their influence. This, along with broader Euroskepticism fostered by the euro crisis, allowed them to push Brexit onto the political agenda and ultimately force Cameron to hold a referendum on it.

Hence why the Brexit vote just happened, as opposed to happening several years ago.

"There are two main political reasons [Brexit is coming to a vote]," Will Somerville, a senior fellow at the Migration Policy Institute, wrote before Thursday's vote. "The internal politics of a governing Conservative Party that has become increasingly Euroskeptic, and the anti-immigration-fueled rise of the UK Independence Party."

This immigration rhetoric has, without a doubt, dominated the pro-Leave side of the Brexit debate. Rhetoric from this camp’s supporters, over and over again, returns to the need to reduce immigration levels. "Many campaigners in favour of leaving the EU see immigration as their trump card," the Financial Times writes.

It is also, according to polling, their strongest issue with the public. A May 2016 poll found that 52 percent of Britons believe Brexit would improve the UK immigration system, while only 21 percent said remaining would do the same. Anti-EU voters tend to come either from the ranks of UKIP supporters or the right wing of the Conservative Party.

"The political leverage generated by UKIP and its successful construction of a narrative that blames deteriorating living standards on an ‘open door’ immigration policy — which, it asserts, is a condition of continuing EU membership — motivated Cameron to call the referendum," Ed Rooksby, an researcher at Oxford, writes in Jacobin.

"They have … transformed the referendum into a proxy plebiscite on immigration."

Brexit has routinized anti-immigrant sentiment

Somewhat depressingly, the official "Remain" campaign didn't choose to make a defense of immigration the core of its case. Instead, its main argument was that leaving the EU would be an economic disaster for Britain, cutting it off from trading partners and triggering a recession.

This is probably correct. The EU is by far Britain’s most important trading partner, and losing the privileged access to its markets granted by membership would likely be major shock.

But this framing of the debate — keeping immigrants out versus protecting Britain’s economy — is concerning. It means the question at stake in Brexit isn’t, "Immigration: good or bad?" It’s, "Immigration: is it so scary that it’s worth risking a recession to try to curb it?"

Harsh anti-immigrant sentiment has become normalized and routinized by the Brexit debate, making it simply a fact of British life.

And now Leave has won — proving that xenophobia not only is powerful in modern Britain but actually has the ability to shape the course of the country's entire future.

The Bobs of Britain are in the driver's seat now.