The Massachusetts Court of Appeals reversed a defendant’s conviction for failure to register as a sex offender Friday, finding that proposed expert testimony about his mental state would have shown whether the “knowingly” element of the charge was met.

Richard M. Corbett appealed to the appellate court after he was convicted by a jury for “knowingly . . . fail[ing]” to register as a sex offender. Corbett registered with a local police department in December 2016, but he was informed that he would have to reregister every 30 days because he was homeless.