Illustration: John Shakespeare In Britain, a virulent anti-immigrant sentiment has powered the campaign to "leave" the EU. Britons will vote on the question later this week. When a right-wing extremist last week murdered a leading advocate for refugees, Labour MP Jo Cox, the shock seemed to temper some of the heat. But three days later, a leading xenophobe, the leader of the UK Independence Party, Nigel Farage, launched an ad campaign with the theme "breaking point". He unveiled a poster showing a photo of a stream of young, swarthy skinned men heading into Europe from Syria. A caption reads: "The EU has failed us all. We must break free of the EU and take control of our borders." The ad campaign, expected to be the biggest of the Brexit campaign, was condemned by all the major parties as racist or xenophobic.

Polling shows the two sides evenly poised on whether Britain should leave the EU or remain. The president of the EU, Donald Tusk, has suggested that a British exit could be the beginning of an event of monumental historical consequence. "Why is it so dangerous?" Tusk posed to the German tabloid Bild. "No one can foresee what the long-term consequences would be. As a historian, I fear that Brexit could be the beginning of the destruction of not only the EU, but also of Western political civilization." Britain isn't the only EU member where anti-immigrant sentiment is rampant. Even before the latest surge of Syrian refugees into Europe, anger and fear was building across the continent. A Gallup poll of 142 countries worldwide in 2012 and 2014 showed that Europe was the most anti-immigrant place on earth. Even then, 52 per cent of Europeans wanted to cut the intake of immigrants. This was double the number of Australians who wanted fewer immigrants. And even then, far right parties were organising. The EU had the freest borders in the world, and it was the most anti-immigrant zone on the planet. This is not entirely coincidental. The EU immigration policy was Utopian. Immigration was poorly managed. But perhaps the primary reason, the one creating preconditions for an anti-immigrant backlash, was the economy. Europe has not recovered from the great recession of 2008. Fascism arose from Europe's Great Depression in the 1930s. The far right parties of Europe are organising in the hope that they can engineer a repeat.

"Already the populist, anti-immigration right is in a strong position, from Sweden to France, Greece to the Netherlands," writes Owen Jones in The Guardian. "So when Greece's motorcycling former finance minister Yanis Varoufakis warns that Europe could be falling into a 'modern 1930s', it's time to sit up, listen – and prepare." In the US, anti-immigrant sentiment is the foundation of Donald Trump's successful campaign for the Republican presidential nomination. He launched his campaign with his attack on Mexicans as rapists and criminals. It was at that moment, his very first foray, that he launched his idea to wall off Mexico. That began an astronomic rise, which Trump boosted with yet more racism and yet more xenophobia. Muslims should be barred from entering the US. Mosques should be subject to police surveillance. Then, last week, an American-born son of Afghan refugees launched a terrorist attack in Orlando, Florida. He identified with Daesh, the so-called Islamic State. There was a moment where the country wondered whether this might change Trump's approach. But only a moment. Trump only intensified his vilification. On the weekend he said US police forces should think about doing more racial profiling – that is, detaining and questioning people based on their race. In Britain and the US, shocking acts of violence are not tempering the peddlers of racial hatred – they are energising them. The US did not have a Utopian border policy like the EU's. It has instead had a cynical one. Illegal immigration has been tacitly endorsed by the political establishment for decades as a source of cheap labour.

In both cases, mismanagement of immigration, compounded by economic downturn, has been the common source of the rage we see building today. Australia has suffered neither of these problems. As Australia's Race Discrimination Commissioner, Tim Soutphommasane, says: "We do need to state the case for immigration and cultural diversity, as there'll always be political elements seeking to exploit fears and anxieties. "But a well-ordered immigration program is good for Australia," he tells me. "It supports our economy, and it reinvigorates our society. We have every reason to be proud of our multiculturalism. Our experience has been very different from Europe, and we must not draw the wrong lessons from what is happening there." Or the US. Even if Brexit is defeated, and even if Trump fails to win the White House, powerful currents of hate and fear have now been set in motion on a mass scale in those countries. They will not disappear – they will seek new outlets. Japan demonstrates powerfully why developed countries need immigrants. The country is dying slowly and cannot rejuvenate without an injection of youthful vigour. That can only come from immigration.

Australia is a multicultural society and an immigrant nation. These are not choices. Our only choice is whether we make a success of it. Peter Hartcher is international editor