GREAT FALLS – The Montana Supreme Court ruled earlier this month that Judge Dirk Sandefur illegally accepted a no-contest plea while overseeing a sexual assault case in Great Falls in 2015.

Sandefur is now an associate justice on the Montana Supreme Court; he left his position as a District Court judge in Great Falls and took his place on the high court in January 2017.

In a plea agreement in Sandefur’s court in 2015, the state sentenced Gary Hansen to 60 years in the Montana State Prison for sexually assaulting an 8-year-old. Hansen was charged with four counts of sexually assaulting the child.

Hansen appealed the sentence, challenging the validity of the plea and the sentence, and raising a claim of ineffective assistance against his lawyer for negotiating a plea agreement based on an illegal plea of “no contest”.

Story continues below

The Montana Supreme Court ruled that no contest pleas cannot be entered in cases involving sexual offenses.

In its ruling, the court said: “There is an express statutory prohibition upon entry of a no contest plea to a charge of sexual assault. Further, we have held that a plea agreement provision that violates a statute can render the agreement ‘void and unenforceable.’”

The Montana Supreme Court then vacated Hanson’s sentence and sent the case back to District Court.

Hansen will be able to enter a legal plea to the charges, enter a new plea agreement, or proceed to trial.

Cascade County Attorney Josh Racki said on Monday that in similar situations, they would likely have a defendant enter what is known as an Alford plea.

In entering an Alford plea, the defendant admits that the evidence would be likely to persuade a judge or jury to find the defendant guilty beyond a reasonable doubt. According to, a defendant acknowledges the evidence but nevertheless maintains that he or she is innocent.

Racki explained, “An Alford plea is a plea of guilty without actually acknowledging the facts. A nolo contendere plea is a plea of no contest. To be honest, it is difficult to explain the difference, but an Alford plea is based on the case that the U.S. Supreme Court ruled that the defendant can always plead guilty regardless of whether he will admit the facts.”

Judge Elizabeth Best has accepted the case.