The U.K. government has pulled out of 5.9 million pound ($9 million) deal to sell prison expertise to Saudi Arabia that drew opposition from rights groups and some senior British officials.

Prime Minister David Cameron's office said Tuesday that Britain had withdrawn its bid for the training contract.

Downing St. also said Cameron was writing to Saudi authorities about the "very concerning" case of a British man sentenced to 350 lashes.

Karl Andree, 74, served a year in prison after being caught with home-made wine and also faces a public flogging. Son Simon Andree said his father might not survive the punishment and asked Cameron "to personally intervene."

Human rights groups are pressing British authorities to take a tougher line with Saudi Arabia, a major strategic and commercial partner.