In what looked like Jeremy Corbyn’s first big political victory, Downing Street announced that the Ministry of Justice had decided not to go ahead with a controversial £5.9m plan to train the Saudis run their jails.
The Prime Minister’s official spokeswoman also revealed that he was today writing to the Saudi authorities to express his worries about the case of pensioner Karl Andree, a Briton facing 360 lashes for possessing home brewed wine.
There were unconfirmed reports that the Saudis was set to Foreign Office calls for Mr Andree, who has already served a year in jail, to be freed without corporal punishment.
Mr Corbyn used his conference speech last month to lambast the Tory government for the bid to help with Saudi training of prison staff, pointing to the case of Ali Mohammed Baqir al-Nimr, sentenced for allegedly taking part in an anti-government protest when he was 17.
But the decision is also a victory for Justice Secretary Michael Gove, who confirmed the decision in the Commons, following claims that Foreign Secretary Philip Hammond had felt his fellow minister was being 'naive' about relations with Riyadh.
Mr Gove had been concerned about the contract, arguing within Whitehall the ‘moral case’ for not helping a regime that uses beheadings, stoning, crucifixions and lashing to punish its citizens.
Today, Downing Street announced that the Government was not going ahead with the bid, but said it was part of a wider move to end the Ministry of Justice’s commercial deals overseas.
The Prime Minister's official spokeswoman said: "This bid to provide the additional training to Saudi Arabia has been reviewed and the government has decided that it won’t be proceeding with the bid.
"The review has been ongoing following the decision that was announced earlier in September to close down the Just Solutions International [the commercial] branch of the Ministry of Justice that was providing some of these services.”
Referring to the case of Mr Andree, she also revealed the PM was today writing to the Saudi government about his 'extremely concerning' case.
“The Prime Minister recognises the plight of this individual and concerns around this case,” she said.
But when asked if Mr Cameron’s move – and the cancelling of the prisons bid - was part of a new era of more robust relations with the Saudis, she replied: “They are separate issues”.
Mr Corbyn, who was in the Commons to hear the U-turn, seized on the Government's decision, but insisted tougher action had still to be taken.
“David Cameron has been shamed into a u-turn on this terrible contract, but why on earth was it set up in the first place?" he said.
"We should be sending a strong message to repressive regimes that the UK is a beacon for human rights and that this contract bid is unacceptable in the 21st century, and would damage Britain's standing in the world.”
Mr Andree is facing 360 lashes for possessing alcohol - which is illegal in Saudi Arabia- and concerns have been raised by his family over his health and whether he would survive the punishment.
Simon Andree, Mr Andree’s son, welcomed Mr Cameron’s intervention, saying: “I am pleased. It has taken an awful long time.”
Kate Higham, caseworker at Reprieve told The Huffington Post UK: "It is extremely welcome that the Prime Minister has dropped the MoJ’s Saudi prisons bid – the decision could not have come soon enough.
"This deal, if it had gone ahead, would have meant the UK was complicit in the same system that is threatening to execute juveniles Ali al-Nimr and Dawoud al-Marhoon for the ‘crime’ of protesting.
"Britain’s alliance with Saudi Arabia, however, remains extremely strong. Cancelling the bid has sent a clear message that the UK does not support Saudi Arabia’s gross violations of human rights, and David Cameron must now use this moment of opportunity to prevent the brutal executions of Ali and Dawoud."
Former Minister Sir Alan Duncan was one Tory to hit out at the decision to cancel the MoJ deal, claiming that it was due to Mr Gove's "caustic personal view of Saudi Arabia" rather than "any legitimate concerns of his department".
"Engagement is far better than disengagement. Disengagement may be a comfortable moral position but it leads to absolutely no progress whatsoever," Sir Alan said.
But Mr Gove hit back: "The decision was taken across government."
The Justice Secretary last month closed down the MoJ's overseas commercial arm that had been set up by his predecessor Chris Grayling.
Yet at the time, it was claimed he could not prevent the go-ahead of the prisons deal as pulling out would incur financial penalties.
Today, Mr Gove said it was "important" that the resources of the MoJ were targeted at "domestic public services reform".
"This government takes very seriously questions of human rights and in particular very seriously the obligation to protect the human rights of British citizens abroad,” he said.
The Times newspaper claimed this morning that the prisons contract row had escalated to National Security Council last week, but claimed that Mr Cameron had come down on the side of Mr Hammond and would still go ahead.
And in a sign of the last-minute confusion over the decision, Michael Spurr, the chief executive of the national offender management service, told MPs only an hour before the announcement that talks were continuing with the Saudis
He said was waiting to see if the bid “came to fruition”.