In a decision unique to the digital era, a man's conviction for soliciting a minor for sex over the internet was overturned because he wasn't allowed to claim that the child lied about her age.

The Minnesota Court of Appeals said Mark R. Moser should have been allowed to defend himself against the charge of soliciting a minor for sex by claiming "mistake of age."

The ruling addresses only solicitation of sex with a minor where there was no face-to-face contact. In this case, the minor claimed she was at least 16 when she was only 14. She and Moser never met in person. Sixteen is the age at which someone is legally old enough to consent to sex.

The court said Moser's due process rights were violated because the Hennepin County District Court didn't allow him to use the "mistake-of-age" defense. Moser, who waived the right to a jury trial, was convicted by Judge Jay Quam.

In September 2014, police received a report that an adult man had used a social media site to solicit a 14-year-old girl for sex, the ruling said. Police met with the child, and she identified Moser as the man she had contact with. Early in the child's social media exchange with Moser, she told him she was 16. He asked for pictures of her and she agreed, but never sent them. They discussed meeting to have sexual contact, but never did. Based on the online conversations, he was charged with soliciting a minor for sex.

Before the judge ruled, prosecutors and the defense knew the decision was going to be appealed. They and the judge agreed that the ruling from the Court of Appeals would be "dispositive," meaning it would determine the outcome. Quam had written in his ruling that there was a likelihood Moser would have been acquitted if he had been allowed to use the mistaken-age defense.

Because of the agreement before the appeal, the Court of Appeals' ruling means Moser has no conviction on his record and won't be retried. Quam allowed Moser to remain free while awaiting the appeal.

The court's ruling acknowledged that "sexual solicitation of children is a grave concern. But the concept that wrongdoing must be conscious in order to be criminal and subject an offender to years of imprisonment has long been a foundation of our justice system."

Defense lawyer Jeffrey Dean represented Moser. He noted that the laws regarding solicitation of minors for sex were written before the internet, when such discussions were held face-to-face.

The law "has not been changed to reflect the fact that many people now meet on the internet, that some misrepresent themselves and that ascertaining a person's age over the internet is virtually impossible," he said.

Dean said protecting children from predators shouldn't hurt law-abiding people. "In fact, respect for the rule of law depreciates when people who are not morally blameworthy are prosecuted for a crime that they had no intention of committing," he said. "Thankfully, now innocent people will be protected by today's court decision."

But Hennepin County Attorney Mike Freeman said he believes the appellate court got it wrong. "What they fail to understand is that modern-day sex practices run through the internet," he said, adding that the court created an "unwarranted" exception allowing Moser's "perverted conduct." Freeman added: "I fail to have a great deal of empathy for a 42-year-old soliciting sex with a 16-year-old."

In face-to-face meetings, the law still maintains a "strict liability" standard. That means that when someone meets a minor face-to-face seeking sex, he or she can't claim to not have known the child was underage. In those cases, Dean noted, an adult "can be reasonably required to ascertain" a child's age.

Appeals Court Judge Lucinda Jesson wrote the 25-page opinion. Judges Carol Hooten and Jill Flaskamp Halbrooks also participated.

Twitter: @rochelleolson