A Helena man is headed to trial after a judge vacated his "no contest" plea to a sex crime against a child. 

Dylan Dunn, 24, was arrested and charged with raping a 17-month-old child in November 2016.

His case was moving to sentencing before Judge James Reynolds vacated his "no contest" plea due to a recent Montana Supreme Court decision.

In a Nov. 14 opinion, the Supreme Court found that fellow justice Dirk Sandefur violated a state law that prohibits "no contest" pleas in cases involving sexual offenses. Sandefur accepted the plea while overseeing a case as a district judge in 2005. 

There was disagreement as to whether Dunn’s plea was a true "no contest" plea or an Alford plea, in which a defendant pleads guilty but does not admit to the criminal act.

Reynolds said this was the first time he had thrown out a plea in his seven years on the bench.

"This plea is not acceptable," Reynolds said.

Dunn’s trial is set for early January 2018.