A London high school teacher who used a camera pen to secretly video female students' chests did so for sexual purposes, but his acquittal on voyeurism charges will nevertheless stand, Ontario's top court ruled in a split decision on Thursday.

In dismissing a prosecution challenge to a lower court verdict, the Court of Appeal found the students had no reasonable expectation of privacy -- a key element of the offence of voyeurism.

London police charged Ryan Jarvis over secret recordings he made in 2010 and 2011 of the students while he was chatting with them. The images, captured in various places in and around the school and lasting from seconds to a few minutes, involved 27 female students aged 14 to 18.

Another teacher spotted what was happening and alerted the principal, who observed the same conduct and called in the police.

Key to the voyeurism charge was that several of the videos, admitted as evidence at trial, focused on the teens' chest areas.

In November 2015, Superior Court Justice Andrew Goodman found Jarvis not guilty, despite deciding his behaviour had been "morally repugnant and professionally objectionable." While Goodman ruled the students had a reasonable expectation of privacy, he found the videos were not sexually motivated.

Among other things, Goodman said, Jarvis had no other pornographic material, sometimes filmed faces, and none of the images showed nudity or sexual activity. The judge also noted that the images showed what could be "readily seen" by anyone.

"While a conclusion that the accused was photographing the students' cleavage for a sexual purpose is most likely," Goodman found, "there may be other inferences to be drawn."

The Crown appealed, arguing it should have been a no-brainer that Jarvis, who did not testify, had been sexually motivated: The subjects were females, and the camera was deliberately pointed downward at their breasts.

In coming to opposite conclusions than Goodman did -- but still upholding the acquittal -- the majority of the Appeal Court panel that heard the case rejected his analysis of the sexual aspect, which leaned on parallels to child pornography. Goodman was wrong, the higher court ruled, to consider the lack of nudity as negating the sexual purposes Jarvis had.

The judge also failed to identify what other purposes the teacher might have had, the higher court said.