In Indiana, it's legal for adults to have consensual sex with minors aged 16 and 17. But it's illegal to sext those same minors, the Indiana Supreme Court ruled this week. The decision reinstated sexting charges against an adult who texted nude images of himself to a girl he knew was 16.

The state's highest court, ruling 5-0, noted that the charges against 40-year-old defendant Sameer Thakar, a high school teacher who has been removed from his post, are "inconsistent" when balanced against the state's laws on consensual sex. But state lawmakers, and not the Supreme Court, can rectify that if they want to, the court ruled.

"The Dissemination Statute clearly protects minors under the age of 18 from the dissemination of matter harmful to them," Justice Mark S. Massa wrote (PDF). "Whether this inconsistent statutory treatment of minors aged 16 and 17 is advisable with respect to sexually-related activity is a matter for the legislature, and whether Thakar’s alleged conduct violated the Dissemination Statute is a matter for the jury."

A lower court had tossed the charges last year because Indiana's law allowed minors as young as 16 to consent to have sexual relations. Thakar did not have sex with the girl, who was in Oregon. The defendant, who faces a maximum of three years in prison if convicted, argued that it was "patently illogical" to hold someone criminally liable for sending nude pictures to a minor—yet it's legal to expose themselves to minors in person.

The Indiana ruling is among a string of cases in which sexting laws are clearly nonsensical. Last month, for example, the Washington Supreme Court upheld the conviction under state child porn laws of a 17-year-old boy who sent a picture of his own erect penis to a 22-year-old woman. The case illustrates a bizarre situation in which the juvenile defendant was both the perpetrator of transmitting child porn and the victim of it.

Last year, we reported on a similar case out of Texas, where it's legal to have sex with somebody as young as 17 years old. But it's considered child pornography to have nude pictures of somebody under 18, even if he or she is 17 and is the same person you had sex with.

Then there was the 2015 case of two North Carolina teens charged with child porn accusations for consensually sexting one another. One of the teens was accused of possessing child pornography because he had nude photos of himself on his phone. The arrest warrant for the boy's girlfriend described her as both a victim and a perpetrator.