A poet sentenced to death in Saudi Arabia for abandoning his Muslim faith has had his sentence of beheading commuted – but must still face 800 lashes and eight years in jail. Ashraf Fayadh was detained by the country’s religious police in 2013 in Abha, southwest Saudi Arabia, and rearrested and tried in early 2014. His conviction was based on evidence from a witness who claimed to have heard him cursing God, Islam’s Prophet Mohammad and Saudi Arabia. Other evidence which led to the barbaric sentence was found in the contents of a poetry book the 35-year-old Palestinian refugee had written years earlier.

The new ruling, posted by Fayadh’s lawyer on his Twitter account, said the court has decided to ‘go back on the previous death sentence’ but confirmed the charges that prompted the death penalty. ‘The accused is sentenced to a punishment of eight years in jail and 800 lashes divided into installments, 50 lashes for each installment,’ the ruling stated, according to the Twitter posting.

A spokesman for Saudi Arabia’s justice ministry could not immediately be reached for comment. A lower court had previously sentenced Fayadh to four years in prison and 800 lashes. The case went to the Saudi appeals court and was then returned to the lower court, where a different judge last November 17 increased the sentence to death. The second judge ruled defence witnesses who had challenged the prosecution witness’ testimony ineligible.

Saudi Arabia’s justice system is based on sharia, or Islamic law, and its judges are clerics from the kingdom’s ultra conservative Wahhabi school of Sunni Islam. In the Wahhabi interpretation of sharia, religious crimes including blasphemy and apostasy incur the death penalty. Saudi judges have extensive scope to impose sentences according to their own interpretation of sharia without reference to any previous cases. After a case has been heard by lower courts, appeals courts and the supreme court, a convicted defendant can be pardoned by King Salman.

The draconian scope of the its punishments has seen the country repeatedly condemned by human rights groups such as Amnesty International and popular protests hoping to force change through political pressure. Liberal writer Raif Badawi was flogged 50 times in January last year after his sentencing to 10 years in prison and 1,000 lashes for blasphemy, prompting an international outcry. Badawi remains in prison and is said to be suffering fainting spells and deteriorating health due to a hunger strike, but diplomats have said he is unlikely to be flogged again.

Ensaf Haidar, who was granted asylum in Canada with the couple’s three children, said by phone she hoped her husband would end a hunger strike he had initiated more than 20 days ago to protest against his transfer to a different prison in Saudi Arabia.

Badawi, who created and managed an online forum, was found guilty in 2014 of breaking Saudi Arabia’s technology laws and of insulting Islam. He was sentenced to 10 years in prison and 1,000 lashes. He received his first 50 lashes in January, prompting strong criticism in Western countries of the kingdom’s human rights record. His wife added: ‘I am very worried about him. His health, both physical and mental, is very poor.’