The Supreme Court took steps Thursday to bring the law up to speed to protect children in the rapidly evolving realm of cyberspace in a ruling allowing judges to ban convicted sexual predators from using the Internet.

The case turned on one narrow legal issue – whether a new law can be retroactively applied to case that predated it.

As a matter of legal principle, the high court rarely allows laws to be applied retroactively, especially when it comes to changes in criminal law on how punishment is to be meted out.

But in Thursday’s 7-2 ruling, the court made an exception, saying the retroactive imposition of a ban on Internet usage was called for because of “grave, emerging harms precipitated by a rapidly evolving social and technological context.”

The 2009 case centered on a British Columbia man who pleaded guilty in an incest and child pornography case involving a victim under the age of 16. There is a court-ordered publication ban on information identifying the victim.

The man was sentenced to nine years in prison.

The trial judge also banned the man for seven years from using a computer to communicate with children under 16. That additional sentence was based on pre-2012 Criminal Code provisions that prevented sex offenders from having contact with children.

That older provision did not explicitly ban Internet use.

After the man was convicted, the Conservative government introduced the Safe Streets and Communities Act, which did create such a penalty.

On the man’s appeal, the B.C. Court of Appeal used the 2012 law to impose the broad Internet ban.

On Thursday, the Supreme Court upheld that retroactive application of the new law, saying the Internet prohibition constituted a “reasonable limit” on the man’s Charter rights.

“This evolving context has changed both the degree and nature of the risk of sexual violence facing young persons,” Justice Andromache Karakatsanis wrote for the majority.

“The rate of technological change over the past decade has fundamentally altered the social context in which sexual crimes can occur.”

Websites such as Facebook and Twitter, dating sites such as Tinder, and photo-sharing applications such as Instagram and Snapchat emerged after 2002, the last time there were any new Criminal Code amendments prior to 2012, said Karakatsanis.

“These new online services have given young people – who are often early adopters of new technologies – unprecedented access to digital communities,” she said.

“At the same time, sexual offenders have been given unprecedented access to potential victims and avenues to facilitate sexual offending.”

The new law was an attempt by the previous government “to keep pace with technological changes that have substantially altered the degree and nature of the risks facing children,” she added.

In past rulings, the Supreme Court has been tough on the previous Conservative government’s tough-on-crime agenda, striking down several sentencing provisions in its new 2012 law, which included mandatory minimum sentences.

This time, the court agreed with Parliament’s attempt in 2012 to close the “legislative gap” that was creating a risk for children.

“New and qualitatively different opportunities to harm young people exist,” it wrote.

“And, as the record and common sense suggest, monitoring an offender’s use of the Internet can limit an offender’s opportunities to offend and prevent this harmful behaviour.”