British grandfather Karl Andree has lived in Saudi Arabia for 25 years so he, of all people, should have known the dangers of flouting that country’s anti-drinking laws.

Andree’s son Simon said as much on the BBC’s Today programme as he appealed for his father’s corporal punishment to be lifted. Andree senior faces 350 lashes in a public flogging for being caught with homemade wine in his car. He has already served a year-long prison term for the offence.

Simon Andree said the family respected Saudi culture but begged for clemency for his father, who is asthmatic and suffering from cancer. The case highlights both the barbarity of a regime with many ties to Britain and also the softly, softly approach of those familiar with its ways.

Britons on the whole probably do not share the Andree family’s patience with Saudi justice and will be outraged at the callous treatment of an old man.

Most people also fail to grasp the attitude of successive British governments to the Saudis, with ministers apparently turning a blind eye to human rights infringements in exchange for lucrative defence deals and investment from the oil rich nation.

Now, though, there is a member of the cabinet who reflects public distaste for the Saudi habit of beating and beheading its criminals. Justice Secretary Michael Gove, a long-time critic of the Saudis’ human rights record, has persuaded David Cameron to scrap a £5.9 million deal providing training for prison officers in the Gulf state.

And the Prime Minister has reportedly written to the kingdom’s rulers to protest against the flogging sentence hanging over Mr Andree. The decision about the training contract has infuriated cabinet colleagues, from Defence Secretary Philip Hammond to Home Secretary Theresa May, to MPs such as Sir Alan Duncan, a member of the Intelligence and Security Committee.

Mr Gove is accused of being naïve and of allowing his moral indignation to cloud his judgment, as if a surfeit of morality is regarded as a flaw in a politician’s character.

Admiration for Mr Gove does maybe cloud this columnist’s judgment, for he is the minister who in his previous incarnation at the Department of Education transformed schools in England.

Born and raised in Aberdeen, he is a man of principle and has never been afraid of courting unpopularity for causes he holds dear. One of these was improving the prospects of under-privileged schoolchildren.

Another was tackling the roots of extremism. While in charge of the schools portfolio he tried to push "British values", advocating that primaries and secondaries promote tolerance, fairness and respect for other faiths. He also spoke out against segregation in some Muslim schools and his fears over the silencing of female pupils.

On foreign policy, he is dismissed by some colleagues for having a "caustic personal view" of Saudi Arabia. The country is an ally of the West’s and an economic partner. But with plummeting oil prices, and the United States shale gas revolution bringing it closer to being a net exporter of energy, the Saudis cannot command quite the same influence they have had for the past 50 years.

The country, for all its apparent strength and stability, has failed to enhance security in the region, or provide leadership to its warring Arab neighbours.

Britain’s links may seem inextricable, with Saudi money keeping the British aerospace firm BAE Systems in business with orders for fighter jets, and the sharing of intelligence just two examples.

Mr Gove has not only hit a nerve in political circles; he also has a nerve. Over at defence, Mr Hammond argues that pulling out of the prison training agreement will damage Britain’s relations with an important friend; that it is better to "engage"; and that the contract was part of a wider effort to reform Saudi judicial institutions.

Mr Duncan talked about "engagement" too. "Is it not the case that when we look at a country’s judicial system of which we do not in many respects approve, engagement is far better than disengagement, and that disengagement may be a comfortable moral position, but can lead to no progress whatsoever?" he asked.

This engagement includes an ongoing arrangement to train Saudi judges and a police training scheme, signed by a predecessor of Mr Gove but, like other attempts at engagement, these do not appear to have made much of a difference so far to the Saudis’ interpretation of Sharia law.

In the past year, the country has executed 175 people. Adultery is punishable by death, as are apostasy, blasphemy, witchcraft, burglary, homosexuality and repeated drug use, among other things. Public beheading is the preferred method of dispatch, although stoning is popular as well.

Mr Andree probably knows enough about Saudi Arabia to think himself relatively lucky and had asked his children not to intervene. Less fortunate is a young man, Mohammed al-Nimr, who was arrested in 2012 when he was 17 for taking part in the Arab Spring protests.

For such a crime – in the UK, protesting would be deemed his right – he faces beheading and crucifixion.

Freedoms taken for granted in Britain are outlawed by the Saudis, with particularly harsh reprisals for political and religious dissent, and for women.

British tolerance makes allowances for such an alien way of life, but it is not our way. People here were largely baffled by the official reaction to King Abdullah’s death earlier this year, when flags were flown from our government buildings at half mast.

President Obama, visiting the new king in January, said: "Sometimes we have to balance our need to speak to them about human rights issues with immediate concerns that we have in terms of countering terrorism or dealing with regional stability."

Mr Gove also said there was a balance to be struck in the West’s engagement with Saudi Arabia. Those who urge that, with the war in Syria and the threat posed by IS fanatics, this is not the right moment to take on the Saudis over human rights, reject the Justice Secretary’s idea of balance.

But David Cameron has come out on his side. After he overruled both Mr Hammond and Mrs May on the prison services agreement, he was accused of being manipulated by his friend Mr Gove.

He was also said to have been moved by the plight of the imprisoned grandfather, though Downing Street insisted the two issues were not connected.

The Opposition claimed he was swayed by Jeremy Corbyn and, if so, this would mark the first blow the new Labour leader has landed on the Government. Mr Corbyn mentioned the prisons deal in his conference speech, when highlighting the fate of the young Saudi prisoner, al-Nimr:

"We have to be very clear about what we stand for in human rights. A refusal to stand up is the kind of thing that really damages Britain’s standing in the world."

All of the above may have brought to bear on Mr Cameron but it is possible that, in the end, he just trusted his own instincts.

This may well not be a good time for Britain to test its relationship with one of the world’s most repressive and most misogynistic regimes but, given the volatility in the Middle East, there will never be a good time.