Last September, the Arizona Supreme Court issued a stunning decision interpreting the state’s child molestation law to criminalize any contact between an adult and a child’s genitals. In a 3–2 ruling, the court found that the law encompassed entirely innocent conduct, such as changing or bathing a baby. Arizona, the court held, could convict an adult for touching an infant’s genitals—which carries a prison sentence of five years—without proving sexual intent. Instead, under the law, the accused had the burden of proving that he had no sexual intent to a jury and by a preponderance of the evidence. As the dissenters noted, the ruling turned “parents and other caregivers” in the state into “child molesters or sex abusers under Arizona law.”

Reason, however, has now prevailed. Last week, a federal judge ruled that the Arizona statute, as interpreted by the state Supreme Court, is unconstitutional. In a lengthy decision, U.S. District Judge Neil V. Wake cogently explained why the law violates the Due Process Clause of the 14th Amendment, vindicating the two justices who dissented on those grounds in September. He also reminded Arizona that parents have a constitutional right to care for their children—a right the state may not interfere with by criminalizing hygienic care.

The basic flaw in the Arizona law is pretty conspicuous. According to the statute, an individual is guilty of child molestation if he “intentionally or knowingly … touch[es] … any part of the genitals, anus or female breast” of a child “under fifteen years of age.” Notice something strange there? Despite calling itself a child molestation statute, the law does not require the “touching” to be sexual. Thus, a caregiver who “intentionally or knowingly” touches an infant’s genitals while changing his diaper is clearly guilty of violating the law. No other state save Hawaii does not require sexual intent for a child molestation offense.

Arizona defended its statute by noting that the defendant could still assert “lack of sexual motivation” as an “affirmative defense” at trial—requiring him to prove his benign intent “by a preponderance of the evidence.” The Arizona Supreme Court was satisfied with this loophole, holding that it rendered the law constitutional. Wake was not so easily fooled. Under the Due Process Clause, Wake noted, the government carries the burden of proving each element of a crime beyond a reasonable doubt. Yet the Arizona law shifts the burden onto the defendant, forcing him to disprove “the very thing that makes child molestation child molestation.”

That requirement, Wake explained, “violates the Fourteenth Amendment’s guarantees of due process and of proof of guilt beyond a reasonable doubt.” Due process does not permit Arizona “to remove the essential wrongfulness in child molestation and place the burden of disproving it upon people engaged in a wide range of acts, the vast majority of which no one could believe the state meant to punish.” Indeed, Arizona cannot lawfully punish “the vast majority” of conduct swept up by the statute. The U.S. Supreme Court has found that the Due Process Clause “protects the fundamental right of parents to make decisions concerning the care, custody, and control of their children.” Therefore, Wake concluded, Arizona may not criminalize “constitutionally protected … innocent conduct” such as “diapering and bathing infants.”

Wake’s ruling overturned the conviction of Stephen Edward May, a swimming instructor who was accused of inappropriately touching four young children. A jury found May guilty of touching the children—though not of touching them sexually, since the law didn’t require that finding—and a judge sentenced him to 75 years in prison. He isn’t the only Arizonan to suffer unjustly under the law; Wake noted that the state has prosecuted plenty of parents, and successfully convicted some, for what may be totally innocent behavior. Those individuals will likely now ask a federal court to vacate their sentence.

Although Wake is an even-tempered judge, his ruling evinced some frustration with all three branches of Arizona’s government—and understandably so. The Arizona legislature actually removed the sexual intent requirement from its child molestation law in an effort to secure more convictions. The governor approved of this change, and prosecutors—despite promises to the contrary—vigorously enforced the modified law, ensnaring guiltless parents in their dragnet. The Arizona Supreme Court then had the opportunity to either strike down the statute or read into it an implied requirement of sexual intent. It did neither, forcing the federal courts to clean up the mess. Is it any wonder Wake was exasperated? For years, Arizona criminalized an essential part of parenting. And only now can moms and dads go back to changing their kids’ diapers without fear of prosecution.