The top court in Maryland ruled this week that a teen who sent a sexually explicit cellphone video of herself to two friends violated state child pornography law.

The teen, referred to in court papers as SK, did not have to register as a sex offender but was ordered to undergo electronic monitoring and probation, which required drug tests and anger management classes as well as permission to leave the state.

The decision, which upheld a decision from a lower Maryland appeals court, means other minors who engage in sexting could face similar legal repercussions.

Amid spreading criticism, one expert told the Guardian it was “a ridiculous reading of the statute” concerned.

The ruling, by a 6-1 majority among the judges on the Maryland court of appeals, said: “We refuse to read into the statute an exception for minors who distribute their own matter, and thus we believe SK’s adjudication as delinquent … must be upheld.”

This 35-page decision stemmed from an incident at a high school several years ago. The student identified as SK was 16 at the time and therefore “legally able to consent to engage in sexual conduct”.

According to the ruling, she and her two best friends swapped “silly photos and videos” in a cellphone-based group chat “in an effort to ‘one-up’ each other”.

I think the case illustrates how troubling the enforcement of sex crimes can be Rebecca Roiphe, New York Law School

“The trio hung out together and trusted one another to keep their group messages private,” the ruling said.

The other group members were identified as AT, a 16-year-old female, and KS, a 17-year-old male. During the 2016-17 school year, SK sent them a “one-minute video of herself performing [oral sex] on a male”.

After the trio fell out, the clip was shared with other students.

AT testified that KS “would always write on the board, like, saying she’s a slut or saying any type of thing” and also urged AT to accompany him to the school resource officer, a member of the sheriff’s department, to report the video. While KS claimed he “was worried about SK and wanted her to receive help”, the court papers said, AT thought his motives “were not so pure”.

“AT testified that KS was bragging around school about SK going to jail if he were to report the text message,” the papers said.

KS, who had a copy of the video in his email account, showed it to Officer Eugene Caballero. He was told to delete it.

Caballero then met SK, who was read her rights. According to Caballero’s police report, SK “cried during their meeting and was upset that the video was going around the school”. The student thought the meeting would stop the video circulating. Caballero did not tell her she was “considered a suspect for criminal activity”.

SK gave Caballero a written statement saying she was in the video and had shared it with her two friends.

Caballero’s report was sent to a state attorney. Prosecutors charged SK as a juvenile with filming a minor engaging in sexual conduct, distributing child pornography and displaying an obscene item to a minor. The juvenile court determined SK was involved in the last two counts.

She appealed, arguing that “the statute was intended to protect, not prosecute, minors victimized and exploited in the production of sexually explicit videos”.

The top court recognized that the issue was more complicated than in cases involving adults – but still ruled against SK.

“On the one hand, there is no question that the state has an overwhelming interest in preventing the spread of child pornography and has been given broad authority to eradicate the production and distribution of child pornography,” the opinion said.

“On the other hand, SK, albeit unwisely, engaged in the same behavior as many of her peers. Here, SK is prosecuted as a ‘child pornographer’ for sexting and, because she is a minor, her actions fell directly within the scope of the statute … As written, the statute in its plain meaning is all encompassing, making no distinction whether a minor or an adult is distributing the matter.”

The judges said they did “recognize that there may be compelling policy reasons for treating teenage sexting different from child pornography” and said legislation differentiating the two “ought to be considered by [Maryland’s] general assembly in the future”.

The dissenting judge said prosecuting SK conflicted with the intent of the state’s child pornography statute.

“She made a video depicting consensual sexual conduct,” Judge Michele D Hotten wrote. “The general assembly did not seek to subject minors who recorded themselves in non-exploitative sexual encounters to prosecution. Rather, the statute contemplates protecting children from the actions of others.”

The decision prompted criticism.

“If there is any victim here,” said Slate, “it is SK, who was allegedly the target of revenge porn by her erstwhile friend KS. Yet KS was never charged with distributing the video, nor were any of the students who passed it around.

“Only SK, humiliated and horrified, found herself charged as a child pornographer. The system failed her at every step, from the school resource officer who treated her like a criminal, to the prosecutor who inexplicably brought a criminal case against her, to the courts that affirmed the prosecutors’ ridiculous reading of the law.”

Rebecca Roiphe, a professor of law at New York Law School and former assistant district attorney in Manhattan, agreed.

“This is a ridiculous reading of the statute,” she said in an email. “The law uses two different terms, ‘person’ to describe the perpetrator and ‘minor’ to describe the victim. The legislature clearly did not intend to criminalize the victim.

“If there were a law prohibiting a person from bringing an animal into the park, it would be absurd to say a man walking alone in the park violated the law because he brought himself.”

Roiphe added: “I think the case illustrates how troubling the enforcement of sex crimes can be and how important it is that prosecutors use their discretion wisely.”