PRESIDENT Obama’s intervention in the UK referendum in favour of Remain was audacious and controversial, just like his, admittedly more oblique, intervention in the Scottish independence referendum two years ago.

The reaction of Dominic Raab MP was revealing about the Brexit campaign’s preoccupations. He said that President Obama wouldn’t dream of opening the US border to free movement from Mexico. For too many in the Leave campaign, the EU debate is all about borders and keeping out migrants.

Immigration has been Brexit’s version of Project Fear. On the Vote Leave website, the very first of its “facts about Europe Union” is a warning about “two-million EU migrants” are waiting to take Britain by storm. This may go down well with Ukip supporters, but xenophobic alarmism and narrow nationalism is not the way to inspire support.

We saw a bit more of what the Leave campaign is made of last week, and it is not attractive. The response to the daft Treasury forecast that Britons would be exactly £4,300 worse off out of the EU was not to come up with a better economic arguments. Eurosceptic MPs Like Christopher Chope, chose instead to complain that the Treasury projection had conceded that immigration was going to continue at present high levels until 2030. Immigration bad.

The Ukip spokesman in Scotland, David Coburn, has been accused of making racist jokes about SNP politicians like Humza Yousaf, and last week even many of his own party decided they'd had enough of him. Boris Johnson, the Brexit-supporting London Mayor, may not have made an overtly racist statement about Barack Obama being “part-Kenyan” but it struck a disturbing note and blew a kind of imperialist dog whistle that only Tories can hear.

The emergence now on the horizon of the French far right leader, Marine le Pen, is also telling. She has suggested that she may come to Britain to aid the anti-European campaign. The official Leave campaigners will have nothing to do with the leader of the French National Front, which is descended from the neo-fascist party of her father, Jean Marie le Pen. Nevertheless, the enthusiasm with which the French nationalist has been able to endorse the Brexit campaign is worrying.

Racists and right-wing populists were not able to capitalise on the Scottish independence campaign, which was also about nationalism – but of very different sort. The Yes campaign's civic nationalism, with its emphasis on social justice and its open-minded attitude to ethnicity and immigration, was not something a politician like le Pen could relate to. And of course, had Marine le Pen dared come to Scotland during the referendum, Yes activists would have given her short shrift – as they did the Ukip leader, Nigel Farage. The sight of Mr Farage besieged in an Edinburgh High Street pub was one of the abiding images of the referendum campaign.

The leave campaign is in danger of being defined as about immigration rather than democratic renewal; fear of migrant invasion rather than a challenge to Europe’s elites. Such is the instinctive hostility to foreigners of many in the campaign that they find it impossible to accept that immigration can actually have economic benefits. Indeed, one reason Britain pulled out of the last recession was the influx of workers from the European Union willing to work here. Scotland better understood the economic case for migration in 2014. With an ageing population, we need young workers not just to do the jobs, but to pay taxes to help finance social care.

Of course there are problems with immigration if it continues at such a level that it overwhelms housing and social services, or if an influx of low-paid migrants undercuts wage rates for indigenous workers. But overall, free movement in the EU is one of the genuine achievements of the European Union. The breaking down of borders and the intermingling of national cultures is a creative force to be weighed against the reactionary behaviour of the Brussels bureaucracy.

The Brexiteers are talking about immigration because it appeals to many disenchanted voters in Tory and some Labour constituencies in England. There is a fear that Britain is being swamped by immigration. It isn’t only opponents of the European Union who feel this, and by no means all in the Brexit campaign are xenophobic. Nevertheless, it is important to note where the Leave campaign is trending – and it isn’t towards social liberalism.

It will soon be make-your-mind-up-time in the EU referendum on June 23. For most Scots, the choice has been a relatively easy one: most voters here seem to be almost instinctively supportive of the European Union and willing to ignore its democratic “warts”. The very fact that many Tories such as Boris Johnson want out of Europe is good enough for many.

But I haven't found the decision so easy. This is largely because the European Union as it exists today is not what those of us who argued the European case in the 1990s hoped to see. It has relapsed into something of an establishment cabal. The EU at present seems more persuaded by austerity economics than even George Osborne, and there is little challenge to the dominance of capital. But the EU has also stood for freedom of movement, human rights, free trade and peaceful resolution of conflict. These are qualities most of us can approve of, even if we don't like the rampant growth of inequality over the past 30 years linked to turbo-capitalism.

President Obama also made a number of telling points last week about the geopolitical consequences of British withdrawal from Europe as well as saying Britain would go “to the end of the queue” on trade deals. We shouldn't automatically accept what other nations' leaders say about the future of our own country – America has her own selfish-strategic interests. But Obama is probably right that Britain’s place in international affairs has been enhanced by its membership of Europe. The departure of the UK could indeed lead to a chaotic breakup of the European Union and encourage the kind of narrow nationalism the Yes Scotland campaign stood against.

However, this is a hugely important decision and one none of us should take take lightly. I've been criticised for sounding anti-European in my recent articles on Europe. I make no apologies for that. There is much to criticise, and it would be a mistake to believe that the EU today is anything remotely resembling a “social Europe”. But it would be a worse mistake to march into the Brexit camp, at least on last week's showing.

It's partly about the company you want to keep. Take the farce over the Scottish Ukip leader, David Coburn, arguably the leading figure in the Scottish campaign to leave the EU. He has always seemed a buffoonish figure, but the splits in his small party indicate a degree of intolerance. Nigel Farage’s remark during the general election about the NHS being overwhelmed by immigrants with HIV was similarly repugnant. As is the way bumptious Donald Trump barks his certainly that Britain is going to vote to leave because of “the EU’s immigration craziness”. With friends like these …

I've criticised the Remain campaign for relying on Project Fear and economic negativism. But the Brexit campaign seems to be relying on another kind of fear: fear of foreigners. Of course, with two months to go, it is possible that a more positive and outward-looking Leave campaign could emerge, one based on a vision of a more democratic and socially conscious Europe. But I haven’t heard any trace of it.

Objecting to the economic policies of the Troika – the EU , IMF and European Central Bank – is not a sufficient reason for leaving the European Union at this moment. Like many political choices, this is going to be a question of voting for the least worst campaign. And after seeing the Brexiteers close up last week, I’m pretty sure now who I see as the best worst.