Donny Barabash and Shane Rollison were acquitted at their 2012 trial of making child pornography because the judge accepted that the so-called private-use exception was available to them as a defence.
The Alberta Court of Appeal overturned the acquittal and convicted the men, but it was not a unanimous decision. One Appeal Court justice said the private-use exception was available because the videos were consensual and for private use.
But the Supreme Court was unanimous in its ruling that the private-use defence cannot be used if it is determined that the girls were sexually exploited.
The high court ruled that the trial judge focused too much on the question of consent and not the broader issue of whether the girls were exploited.
"The trial judge was also required to holistically assess the nature and circumstances of the relationship to determine whether sexual activity was rendered unlawful," wrote Justice Andromache Karakatsanis for the court.
"By failing to consider whether the underlying relationship between the complainants and the appellants was exploitative, the trial judge erred in law."
The saga of two girls, who were 14 at the time, began when they ran away from a High Prairie, Alta. treatment centre and found their way to Edmonton.
One of the girls had fallen into prostitution and they abused crack cocaine and marijuana.
They went to stay with Barabash, then 60, and Rollison, then 41, who supplied them with drugs and a roof over their heads.
The girls also performed explicit sex acts on video, which Barabash kept and never showed them.
One of the girls was asked if she wanted to do what she did, according to the federal attorney general's written submission.
"I wanted the drugs," the girl replied.
At the time, a 14-year-old could consent to sexual activity but the law has since raised the age of consent to 16.
The trial judge and the one appeal court judge supported an acquittal for the men on the basis that the sex acts and the recording were "ostensibly consensual," and that the pornography that was created was privately held.
But the Supreme Court offered further clarification, in a ruling that will guide how the two men are retried, saying that "even if a young person consents to the sexual activity, it may nonetheless be unlawful in certain circumstances."
The high court ruling said that another section of the Criminal Code makes it an offence to exploit youths up to age 17. The criteria includes if the young person is in a "relationship of dependency" or if an adult "invites, counsels or incites a young person" to engage in activity with a sexual purpose.
Justice Minister Peter MacKay said he was reluctant to comment on the specifics of the case because it is still before the courts, but noted the government has tabled legislation aimed at deterring people who prey on children.
"What I can tell you is that in all circumstances where children are vulnerable, where there are — let's call them extenuating circumstances that should be considered and should be before the court — we expect and we understand that the judges will take notice of that and I think that those were factors in this case," MacKay told reporters in Victoria.