Image copyright Reuters Image caption A judge ruled the couple was entrapped by Canada's national police force

A Canadian couple convicted of a terrorism plot will be set free after a judge ruled they had been entrapped in a police sting operation.

John Nuttall and Amanda Korody were found guilty of planting pressure cooker bombs at the British Columbia legislature on Canada Day in 2013.

A judge said police manipulated the couple into carrying out the attack.

The pair did not have the mental capacity plan the attack on their own, the judge added.

"The world has enough terrorists. We do not need the police to create more out of marginalised people," British Columbia Supreme Court Justice Catherine Bruce wrote in her ruling.

Nuttall and Korody, two Canadian-born citizens, were convicted in 2015 on three terrorism-related charges, including conspiracy to commit murder and possessing explosive devices for a terrorist group.

Image copyright Getty Images Image caption The legislature of British Columbia was the intended target.

The couple faced life in prison.

However, their convictions were not registered after defence lawyers argued that police had entrapped the couple.

The Royal Canadian Mounted Police, the country's national police, undertook a months-long, undercover sting operation that ended in the couple's arrest.

But Judge Bruce said the police made an "enormous effort" to assist the couple in carrying out the attack.

"The defendants were the foot soldiers but the undercover officer was the leader of the group," the judge said.