IT takes a truly startling level of political ineptitude to unite almost the entire country, including most members of your own party, in denouncing your policies as not only moronic but cruel. But the Home Office has managed it with its truly abysmal handling of the case of the Windrush generation.

These are the Commonwealth citizens who arrived in the UK before restrictions were imposed by the 1971 Immigration Act, some of whom have now been told that they have no leave to remain in Britain unless they can prove they were residents before January 1973 (when the Act came into force).

You might think it mind-bogglingly incompetent that the authorities have, for the past four decades, apparently not kept any records. And you might think that, if you could show that you were at school in Britain in the 1950s or 1960s, or had paid decades worth of National Insurance, that would settle the matter.

Not a bit of it. Some of the cases are frankly incredible. Paulette Wilson, who arrived in Britain aged 10 and is now 61, was dragged off to a detention centre and very nearly deported to Jamaica, a country she hadn’t visited for 50 years, and where she had no relatives. For much of her time in the UK, during which she was paying her taxes, she was a cook at the Houses of Parliament. Others have been deported, or lost their jobs, or been denied healthcare or British passports. Yet all of these people are here legally, and entirely entitled to British residency. This is so clearly a scandal that almost everyone is up in arms about it, yet Number 10 at first even refused to meet the leaders of Commonwealth countries to address the issue. This isn’t only Guardian readers having a go at the Tories; the Daily Mail is just as outraged. The Sun ran a leader denouncing it, which Ruth Davidson approvingly retweeted. Jacob Rees-Mogg described the Home Office’s stance as “disgraceful”.

You have to wonder quite how dim you would have to be not to have anticipated this reaction. No one, other than out-and-out racists, could possibly ever have questioned the status of people in this situation. And the reason that these cases have arisen is because of the idiocy of Theresa May who, as Home Secretary, introduced the “hostile environment” policy, and the incompetence, bureaucracy and intransigence of the civil service. This isn’t a question of granting some kind of amnesty to illegal immigrants who have been here a long time – they have always been here legally, and the burden of proof being demanded by the authorities is entirely unreasonable.

There was a belated U-turn in the government’s stance at lunchtime yesterday, but I fear it exposes a deeper malaise which arises from Mrs May’s attitudes, forged over years at the Home Office.

Almost all long-serving Home Secretaries have a distorted view of government and develop a tendency towards authoritarianism. And it’s not confined to Tories; David Blunkett, Charles Clarke and John Reid all became increasingly power-crazed. They invariably overestimate the importance of issues such as crime (which has been falling for decades), security and immigration, because they fall within their department’s remit.

I happen to be in favour of unqualified free movement, for the reasons that I’m in favour of free trade. In an age of globalisation and service industries, restrictions on the movement of labour are as counter-productive as tariff barriers. And it’s a matter of empirical fact that immigration has been an economic benefit, rather than a cost.

Despite that, I accept that there’s nothing intrinsically wrong or racist about discussing immigration. It is, on one level, government’s primary duty to define its borders and sovereignty. Indeed, public discourse suffered because of a general consensus that even to raise the issue was questionable.

But Mrs May seems to think that the public is as obsessed by the issue as she is. Having campaigned for Remain during the EU referendum, her idea of implementing Brexit begins and ends with halting free movement. Instead of listening to liberal Brexiters from her own party who wanted greater trade freedom, she lined up with demented Little Englanders who think Nigel Farage is a statesman – even though they are a tiny minority (polling has consistently shown that very few Leave voters had immigration as their priority).

The status of EU citizens resident in the UK should have been dealt with in five seconds, by simply announcing that their right to remain was not in question, but instead she made a pig’s ear of it. That’s a typical Home Office mentality, where common sense is ignored in a bid to look strong. It’s a stance usually simultaneously undermined by a proven inability to run a bath.

It was perhaps predictable that the Prime Minister’s clueless notion of what Brexit ought to entail would leave us open to the prospect of a settlement that makes matters worse, though some of us hope that may yet be averted. But few could have foreseen that her myopia and ineptitude would lead to the rights of British residents being comprehensively trampled on as well.