A British grandfather who faced being flogged for breaking Saudi Arabia’s anti-alcohol laws is to be freed as the two nations attempt to repair their diplomatic rift.

Karl Andree’s release was announced by Philip Hammond, the Foreign Secretary, during a visit which comes just days after the Saudi ambassador to Britain warned of an “alarming change” in the relationship between the countries.

Relations cooled dramatically after the Government cancelled its bid for a contract to train Saudi prison staff – a move Mr Hammond opposed on the grounds it would harm business and political ties with the Kingdom. The timing of his visit caused surprise, but within hours of arriving in Riyadh he announced that Mr Andree would be let out of jail within a week.

The 74-year-old former oil executive has been behind bars for 14 months after being caught with home-made wine in his car. He was sentenced to 350 lashes, but his family warned the punishment could kill him as he is already weak from three bouts of cancer.

Confirming the planned release as a “good outcome”, Mr Hammond said it had been achieved through the “strength, depth and breadth” of Anglo-Saudi relations.

The Foreign Secretary is holding talks with King Salman bin Abdulaziz, and other members of the royal family and officials during his visit.

Mr Andree’s son, Simon, said: “It is great news if what the Saudis and the Government is saying is true. I’m absolutely thrilled. Hopefully we’ll have him home next week.”

He said the family had been told yesterday that Mr Hammond was in Saudi Arabia, but only learned of the promised release when news broke on television.

More than 230,000 people signed a petition urging David Cameron to intervene in the case and three of Mr Andree’s grandchildren appealed to the Prime Minister in a video message, in which they said he was ”really old” and “no human deserves to be treated like this”.

Ten places where most executions were carried out in 2013 Show all 10 1 /10 Ten places where most executions were carried out in 2013 Ten places where most executions were carried out in 2013 1. China Amnesty International does not have an official figure on executions in China during 2013, but believes the figure to be in the thousands Ten places where most executions were carried out in 2013 2. Iran Iran carried out 369 public executions Ten places where most executions were carried out in 2013 3. Iraq Iraq committed 169 public executions in 2013 Ten places where most executions were carried out in 2013 4. Saudi Arabia Saudi Arabia carried out 79 executions in 2013 Ten places where most executions were carried out in 2013 5. USA Thirty-nine people were executed in the US in 2013 Ten places where most executions were carried out in 2013 6. Somalia In Somalia, 34 people were publicly executed last year Ten places where most executions were carried out in 2013 7. Sudan Twenty-one people were executed in Sudan Ten places where most executions were carried out in 2013 8. Yemen Thirteen people were executed in Yemen in 2013 Ten places where most executions were carried out in 2013 9. Japan Eight people were executed in Japan, according to the report Ten places where most executions were carried out in 2013 10. Vietnam Vietnam does not release public figures on executions but Amnesty estimate the number to be a minimum of 7

Last week the Saudi ambassador, Prince Mohammed bin Nawaf bin Abdulaziz, warned of the “potentially serious repercussions” of a breakdown in relations with the UK and pointed to the cancellation of the prison contract as evidence of an “alarming change in the way Saudi Arabia is discussed in Britain”. He warned the Kingdom would not be “lectured to” and called for respect for its strict system of sharia, or Islamic law.

But Amnesty International’s UK government and political relations manager, Lucy Wake, said: “The Foreign Secretary should refuse to wear a Saudi muzzle. Mr Hammond must not be cowed.”

She said Mr Hammond should raise the cases of Ali al-Nimr, sentenced to beheading and crucifixion after taking part in a pro-democracy demonstration, and the blogger Raif Badawi, sentenced to 1,000 lashes and 10 years in prison for insulting Islam.

Ms Wake added: “There’s a catastrophic civilian death toll in Yemen, with even hospitals being bombed, and we fear UK weaponry is being used by reckless Saudi forces.

“Mr Hammond must inform the Saudi government that the UK is not willing to be a party to terrible war crimes in Yemen, and is suspending arms exports to Saudi Arabia while that risk remains.”

During his tour of the Gulf, Mr Hammond will also meet the leaders of Qatar and the United Arab Emirates and give a speech on extremism – which he has described as “the great challenge of our time” –at a summit in Bahrain.

Shashank Joshi, senior research fellow of the Royal United Services Institute, said the recent friction would not end the close government ties between the two countries.