Pakistan’s supreme court has struck down the death sentence for blasphemy handed down to Christian woman Asia Bibi, in a long-delayed, landmark decision that will free her after nine years on death row and has ignited countrywide protests from Islamist groups.

The court, in a three-member bench led by the chief justice, Saqib Nisar, ordered Bibi’s release on Wednesday morning in Islamabad. By the afternoon, thousands of club-wielding demonstrators had blocked highways, burned tyres and pelted police with stones in major cities including Islamabad and Karachi.

Publication of the 56-page ruling was delayed for three weeks after blasphemy campaigners promised to “paralyse” the country and kill the judges if they did not uphold Bibi’s death sentence.

In a televised address after the verdict’s release, the prime minister, Imran Khan, issued a strong defence of the decision, terming it “according to the constitution and Pakistan’s constitution is according to the teachings of Islam”.

Play Video 0:33 Asia Bibi: protests erupt in Pakistan after blasphemy conviction overturned - video

The leader of the Pakistan Tehreek-e-Insaf (PTI), who was criticised during his election campaign for aligning with far-right Islamists, threatened firm government action if protesters did not disperse and warned the population not to listen to agitators seeking to make political gain.

“Only enemies of the state call for the execution of judges,” he said.

Christian farm labourer Bibi, a 47-year-old mother of five, was sentenced to hang for blasphemy in 2010. She had angered fellow Muslim farm workers by taking a sip of water from a cup she had fetched for them on a hot day. When they demanded she convert to Islam, she refused, prompting a mob to later allege that she had insulted the prophet Mohammed.

Justice Asif Khosa, in a verdict widely praised for its courage and rigour, noted that the two sisters who accused Bibi “had no regard for the truth” and that the claim she smeared the prophet in public was “concoction incarnate”.

“It is ironical that in the Arabic language the appellant’s name Asia means ‘sinful’,” Khosa went on, “but in the circumstances of the present case she appears to be a person, in the words of Shakespeare’s King Lear, ‘more sinned against than sinning’.”

Authorities have removed Bibi from Adiala jail, in Rawalpindi, as they seek to get her out of the country as quickly as possible. In a phone call with AFP before her release, she said: “I can’t believe what I am hearing. Will I go out now? Will they let me out, really? I just don’t know what to say, I am very happy, I can’t believe it.”

The media has been prevented from discussing the case since the verdict was reserved on 8 October and footage of the spreading protests on Wednesday was avoided by increasingly censored TV stations.

In the past 24 hours, paramilitary security forces have deployed across the capital, protecting the judges’ enclave and the diplomatic zone. About 300 police were stationed to guard the supreme court. The southern province of Sindh has imposed a 10-day ban on rallies of any kind.

Facebook Twitter Pinterest Protesters chant slogans during a demonstration in Lahore against the decision to overturn the conviction of Asia Bibi. Photograph: Arif Ali/AFP/Getty Images

Thousands of club-wielding supporters of Tehreek-e-Labbaik (TLP), a fast-growing political party dedicated solely to the punishment of blasphemy, took to the streets.

Khadim Rizvi, the TLP leader, announced he would “paralyse the country within hours” if Bibi was freed and acolytes returned to the Faizabad interchange in Islamabad, the site of a three-week-long protest camp held by the party last year that crippled the capital.

One TLP chief, Afzal Qadri, said all three judges were now liable for death and called for the army to mutiny against its leaders if they supported the decision.

Blasphemy carries an automatic death penalty in Pakistan’s legal system, and although the state has never executed anyone for the offence, vigilante mobs have killed at least 65 people since 1990, according to the centre for research and security studies. Ahead of the verdict, the third witness in the trial, a cleric, told the BBC that “reversing the two previous decisions in the case [is] encouraging people to take the law into their own hands”.

The case against Bibi highlighted two issues with blasphemy laws in Pakistan: how allegations can be used to settle personal scores, and lower-court judges feel unable to acquit defendants for fear of their lives. The supreme court was due to hear Bibi’s appeal in 2016, but delayed the trial after one of the judges recused himself. In 2011, the governor of Punjab province, Salmaan Taseer, and the minorities minister, Shahbaz Bhatti, were murdered after they spoke in defence of Bibi and called for reform of blasphemy laws.

Bibi, who is the first woman to be sentenced to death for blasphemy in Pakistan, has remained in solitary confinement for the past eight years. On 7 October, Ashiq Masih, Bibi’s husband, rejected reports that his wife was suffering from dementia and said she was “spiritually strong” and “ready and willing to die for Christ”. In February, Pope Francis met Ashiq at the Vatican, and Pakistan’s small Christian minority held fasts and prayer sessions before the verdict.

Shahbaz Taseer, the son of the murdered governor Salmaan Taseer, told the Guardian: “This is a huge victory for my father, for Pakistan, for the poor, for the judicial system, for every marginalised person in this country.

“I have seen so much in my very short life. I have never seen anything like this. I was released [from five years in Taliban captivity], the same day that Mumtaz Qadri [the killer of his father] was hung. But this is even better than that, this is justice at last.”