Who Should Get to Stay in the UK (BBC Two) was not, alas, an amusing parlour game allowing one to strike through the names of those who are already here and whom one would prefer to kick out. (I have a list to hand, running from close family members, through personal nemeses, on to anyone mounting a leadership challenge and ending with all homeopaths.) It was the rather more sobering consideration of who, out of the 700,000 people from outside the EU who apply to remain here every year, the Home Office – operating via a network of rules and regulations so byzantine and in such constant flux that experts in the field describe themselves as “unsure of the law on any given day” – deems fit to stay.

The opening episode (the first of three) focused on four representatives of the main routes in. Valeriya, a 27-year-old Russian on her fifth student visa, has been given £200,000 from her father (“We are millionaires, not billionaires”) to start her own fashion business in order to qualify for an entrepreneur’s visa. Thirty-year-old Rashed developed Crohn’s disease while he was here as a student and has now outstayed his visa by five years while being treated on the NHS (for free, although this is technically in contravention of current rules). He has been refused leave to stay and is appealing on humanitarian grounds, because if he returns to his native Bangladesh he will not be able to access the treatments that keep him alive. Dillian, from Trinidad and Tobago, has already been shot once because of his status as a known gay man and is applying for asylum here. Ajmal is Scottish and applying for work visas for three Indian chefs who have the expertise he needs to expand his high-end restaurant and takeaway business.

The frustrations are legion. If, as the CEO of the Joint Council for the Welfare of Immigrants Satbir Singh notes, the question of who is allowed in, is as often as not, an economic one, why is Ajmal hamstrung in his efforts to recruit three people who would, in effect, create more than 50 local jobs? He has tried for three years to find people with the requisite skills within the UK, but is barred from looking elsewhere because, although chefs are on the list of workers of whom we have a recognised shortage, anyone having anything to do with takeaway food is not. “Current legislation is … restrictive sometimes to the point of absurdity,” says his lawyer delicately. “All I’m looking for,” says Ajmal, speaking for anyone dealing with bureaucracy, “is a basic measure of common sense.”

Sometimes it is the clients who make life difficult for themselves. Valeriya can’t put a workable business plan together and Dillian (“A bit of a Walter Mitty character,” his lawyer says wearily) can’t stop overcomplicating his life story and distracting from the fact of his shooting and assured persecution if he is sent home.

But whatever the apparent factors in these decisions, the programme’s weaving together of personal stories and expert commentary gradually shows the more intangible mechanisms at work. Access to the UK depends on a strange brew of political expediency (who is the government pandering to and when); racism (in all its myriad and subtle hues, staining every layer of society and the institutions guarding and shaping it); economic considerations (including the duty to protect finite resources against chancers, so that they are there for the people who fund them); and human compassion. The brew’s toxicity rises and falls according to which elements are in the ascendant.

At the same time, the show made points rarely heard in mainstream discussions of immigration. Barrister Colin Yeo noted that the dominant narrative is of immigrants gobbling up an unfair share of some notional national pie, when what they actually do is increase the size of the pie itself. Others pointed out that there is no equivalent to the presumption of innocence in immigration law; each case stands on its own merits and is subject to laws so complex that how they are applied often looks like no more than whim.

Among the subjects here, justice appeared to be largely done in the end. Rashed and Dillian are staying. The Migration Advisory Committee showed a small measure of common sense and advised removal of the takeaway restriction. And Valeriya is waiting to hear if the Home Office reckons the UK needs another fledgling fashion business from someone with a lot of clothes but no plan. Rashed has had further surgery since filming, which suggests a death sentence was indeed averted. Sip your brew and wonder what it cost to save him, or what it would have cost us to send him back to die.