Unfortunately it wasn’t the “government” - it was UKIP, the party that started out as a liberal opposition to the EU and was taken over by anti-immigrant racists (the founder left in disgust.)
UKIP got enough supporters to worry the Conservative Party - who promptly, instead of standing up to it, started to try to steal its clothes. And the right wing newspapers followed suit. Then they started on supposed “immigrant benefit scroungers” and now we have an anti-welfare agenda which is about to hit working families (but not of course pols and journalists.)
The amount of money spent on retaining a right wing government in this country has been unusual for a British election. It has succeeded…just as Portugal and Canada go the other way.
UKIP is now a spent force, but the evil effects of its racism and xenophobia will be around for a long time.