“Computer says no”. That's where it starts. The blank face of the immigration official as you try to explain that you are who you say you are. It ends with British citizens being being detained, denied cancer treatment, refused housing, losing careers and even being deported to countries they’ve never visited in their adult lives.

On the 50th Anniversary of Enoch Powell's Rivers of Blood speech, the reality dawned last week that Britain has been running a racist immigration policy. No wonder the three million odd EU citizens living and working in Britain are deeply worried about their future after Brexit.

It wasn't just the loss of 1950s landing cards that led to the Windrush sons and daughters being threatened with deportation despite having been British citizens for half a century. It was bureaucratic intransigence, petty officialdom and an over-strict interpretation of the rules. But the jobsworths in the UK immigration service didn't start behaving in this way out of spontaneous racism. They were told, from the very top, from Theresa May herself when she was Home Secretary, that there had to be a “hostile environment” for illegal immigrants. In practice this meant making life as difficult as possible for people caught in possession of a dark skin or a foreign name.

Immigration officials used to have discretion to accept common sense evidence of British nationality, such as a long employment record or a pension. But after 2012 the government changed the rules and required that migrants had to provide four pieces of documentation. The 2014 Immigration Act included the infamous “deport first, appeal later” approach, and started putting pressure on employers to prove that their workers were not illegals. That was blatantly discriminatory because white British nationals were clearly not going to be given the third degree when they applied for a job as a hospital porter or a bus driver.

The hostile environment didn't just affect the 50,000 or so Windrush generation. When those Home Office vans started touring around London advising them to “Go Home” it wasn't just illegal immigrants who were demonised. The 'right to rent' rules made landlords responsible for checking the immigration status of prospective renters and employees – turning them into a kind of immigrant police force. A more racist policy could scarcely be imagined. It meant automatic discrimination against foreigners, but in particular against people of colour who were the most obviously non-British. Countless British citizens have been subject to humiliating identity checks of a kind that you would expect in an authoritarian state. Domestic workers from overseas were even prevented from changing employer, a measure which Liberty said left them open to “exploitation or destitution”.

How many lost housing, lost jobs or were simply treated inhumanely as a result of government policy is impossible to know, and for various reasons, we probably never will know. The main non-Scottish parties – Labour, Tory, Liberal Democrat - have all been implicated in this scandal and may be reluctant to see it thoroughly investigated. The destruction of the Windrush landing cards in 2009 was under the watch of a Labour minister, Alan Johnson. He insists that he didn't know about this and never used the term “hostile environment”, as has been alleged.

Nevertheless, Labour was evidently caught up in the panic about immigration in the noughties. Gordon Brown, only one year previously, made an infamous speech about “British jobs for British workers” - a phrase formerly used by the BNP. Labour and the British establishment were terrified of Ukip and the London tabloids, which were providing a constant stream of anti-immigrant propaganda. “Migrant Workers Flooding Britain” “90% of New Jobs go to Migrants” “Enough is Enough” etc etc etc. Even the Liberal Democrats, who entered into coalition with the Conservatives in 2010 went along with the draconian drift of Tory immigration policy, though according to their leader, Vince Cable, they made their objections known internally.

To their credit, all the SNP MPs in Westminster at the time voted against the 2014 Immigration Bill. The Scottish government has been a consistent critic of the UK immigration policies, not least because they are damaging recruitment in Scotland. Only a handful of Labour MPs voted with the SNP MPs against the legislation and one of them was Jeremy Corbyn. With remarkable prescience, Corbyn told parliament in 2014 that the Home Office risked creating “a generation of stateless citizens”. Yet he is now being smeared as an anti-semite racist by right-wing Labour MPs who seemed quite happy to go along with that racist immigration bill.

Britain's draconian immigration rules didn't just apply to elderly British citizens from the Commonwealth. They humiliate and obstruct the entry of students, scientists, and academics to our many universities, as well as the thousands of people who come here to work in the NHS and other public services. The rules even hit British citizens. If you happen to marry and have two children abroad, your family will be barred from entry to the UK unless you personally (not your spouse) earn above £25,000. What is all this meant to achieve? Brexiteers said that 'Global Britain' would show an open face to the world, not a blank wall.

It all goes back to David Cameron's 2010 election pledge to cut immigration to the tens of thousands – a target that was absurdly unrealistic when Britain was attracting 300,000 odd workers and students from abroad. There was a largely fictitious media scare about 'benefit tourism' and 'health tourism', which the Conservatives exploited in their election propaganda. It has always been the case that migrants from countries like Poland came here to work, not languish on our feeble benefits system. They pay taxes that help to pay for our social services and, by having children, they made a significant contribution to reversing Scotland's population slide.

The tragedy of this whole immigration saga is that these workers are now going home because they feel unwanted here. Indian students are going to Canada or Australia for their degrees. Doctors from Commonwealth countries resent being treated as aliens. Many teachers and nurses cannot work in the UK because they don't earn above the deportation levels of income. The Windrush scandal has led to European countries and Commonwealth leaders regarding Britain as a Powellite nation, which can't be trusted to look after the welfare of EU citizens working here after Brexit.

And the tragedy is that respect for immigrants generally has never been higher among the British population, despite the repeated media hate campaigns. The vast majority now accept that migrants are a benefit to the UK. Powell's forecasts of civil disturbance never came to pass, even as the numbers of immigrants soared beyond the one million he believed would lead to blood in the streets. Britain is now, on the whole, a tolerant and diverse community.

Except in government. It is Theresa May who personally bears responsibility for Britain's pariah status, through her doctrinaire and irresponsible policy of intimidation and threat towards British citizens and migrant workers. She can't now blame the jobsworths and faceless officials who were carrying out her orders. If anyone were to be called on to pay with their jobs for the perversion of our immigration service, it would have to be the Prime Minister herself.