John Nuttall, left, holding a Qur'an, and Amanda Korody appear in provincial court in Surrey, B.C., on Tuesday, July 9, 2013. The Canadian Press/Felicity Don

Canada's federal police entrapped a couple convicted of a terror plot to blow up government buildings, and therefore their convictions will be overturned, the BC Supreme Court ruled today. The verdict is believed to be the first time a terrorism case in North America has end with an entrapment verdict.

The ruling calls the police's use of surveillance and undercover operations into question, and serves as an important precedent as law enforcement agencies across Canada and the US grapple with the threat of terrorism.

Vancouver couple John Nuttall and Amanda Korody, both recent converts to Islam, were convicted last year for plotting to attack BC government buildings with pressure-cooker bombs on Canada Day in 2013. They were found guilty of conspiracy to commit murder and possessing explosive devices for a terrorist group. Nuttall and Korody pleaded not guilty.

Their convictions were based on evidence obtained during an elaborate sting operation carried out by 240 police officers, including more than 70 hours of surveillance footage of the couple.

However, those convictions were put on hold while their lawyers launched a lawsuit arguing that the Royal Mounted Canadian Police (RCMP) entrapped the couple and coaxed them into planning to plant the bombs, instead of the other more dangerous ideas the couple talked about. Defence attorneys have maintained throughout the proceedings that police targeted and took advantage of Nuttall and Korody, who were poor drug addicts vulnerable to manipulation.

BC Supreme Court Justice Catherine Bruce slammed the RCMP in her ruling, concluding that the force manipulated the pair and that it was "a clear case of police-manufactured crime."

"The world has enough terrorists. We do not need the police to create more out of marginalized people," she said.

Later on Friday, the prosecution filed an appeal of the decision. And very shortly after Nuttall and Korody walked free, Vancouver police officers arrested and took them back into custody while the Crown applies for a terrorism peace bond against them, a temporary measure meant to prevent people from committing terrorism acts by placing restrictions on their movement and behavior.

According to heavily redacted court documents released earlier this year during the closed-door entrapment hearings, someone with ties to the Canadian Security and Intelligence Service (CSIS) may have had a role in radicalizing Nuttall.

Judge says RCMP knew Nuttall didn't have mental capacity to 'craft a realistic' terror plan. — Martin MacMahon (@martinmacmahon)July 29, 2016

Bruce told the court on Friday that the police isolated Nuttall and Korody "from outside influences" and also gave them religious advice.

In February, Omid Safi, head of Islamic studies at Duke University was brought it as an expert witness for the defence team in the case and told the court that the police offered "highly dubious" interpretations of Islam to Nuttall and Korody.

Safi spoke with VICE News after the verdict on Friday, and said that he welcomes it.

"I hope that overturning these convictions will be another step in ushering in a good relationship with the Muslim community, because we're going to need it," he said. "In this case, it is so abundantly clear that the state spent a massive amount of time, effort, and money in leading the suspects down to the inevitable conclusion that they himself would have got to on their own. This decision should be celebrated."

He added that entrapment does "nothing to keep us safer, and actually fosters an environment of suspicion."

Judge says police isolated Nuttall & Korody 'from outside influences' couldn't consult Imams, undercover officer gave religious advice. — Shelby Thom (@ShelbyThom980)July 29, 2016

The prosecutor told the court last month that the sting operation was not entrapment, but an "innovative and effective undercover investigation in which [federal police officers] provided two suspects the opportunity to execute their jihad, to be the terrorists they wanted to be, while protecting the public by ensuring their plan did not succeed."

In 2014, Human Rights Watch and Columbia University released a report that concluded the US Justice Department and the FBI have targeted American Muslims, as well as vulnerable people with mental illnesses, as part of "abusive" counterterrorism sting operations. Authors of the report examined 27 federal terrorism cases and found that in some cases, the FBI "may have created terrorists out of law-abiding individuals by suggesting the idea of taking terrorist action or encouraging the target to act."

According to the report, the bar on entrapment under US law is so high that it's "almost impossible for a terrorism suspect to prove."

The report notes that other studies have found that more than half of US federal counterterrorism cases have relied on informants, and 30 percent were undercover operations where the informant played an active role in the terror plot.

Last month, the New York Times reported that the FBI has started using sting operations more often than ever before in terrorism investigations. Undercover operations, often involving agents posing as jihadists and gun dealers, are being used in an estimated two out of three prosecutions involving people accused of supporting the Islamic State.

John Nuttall (centre) and Amanda Korody (right) about to leave BC Supreme Court — Farrah Merali (@FarrahMerali)July 29, 2016