A Montana teacher who received a 30-day sentence for raping a 14-year-old student will return to court Friday because of an apparent misinterpretation of state law by the presiding judge, who was blasted for the decision and comments he made on the case.

But the move may be too little, too late for the judge -- at least as far as his critics are concerned.

But the move has failed to quiet criticisms of the judge overseeing the case.

The judge, G. Todd Baugh, has faced widespread condemnation from activists, elected officials and others for the sentence he ordered and for saying that the teacher's victim, Cherise Moralez, was "older than her chronological age" -- she was 14 at the time -- and asserted she had some control over her months-long relationship with the man.

Judge Baugh said Tuesday that state law appears to require a two-year mandatory minimum prison term for the teacher, Stacey Rambold, 54, of Billings.

"In the Court's opinion, imposing a sentence which suspends more than the mandatory minimum would be an illegal sentence," he wrote.

The judge later apologized for his controversial comments, but those who have called for him to resign said an apology is not enough.

Moralez killed herself before Rambold's case came to trial. That left prosecutors without their main witness and led them to strike a deal with Rambold that allowed him to avoid prison until he violated the terms of his court-ordered release.

Court records show that the sentence Baugh handed down was in line with what Rambold had requested.

Prosecutors, who sought 20 years prison with 10 years suspended for Rambold, have described his actions with Moralez as "the ultimate violation" of the trust she had placed in him as a teacher.

"I wish the judge had been thoughtful enough to get it right the first time," said Eran Thompson with Not in Our Town, a Billings group that promotes diversity and works against hate crimes.

"The judge cannot take back the words he said when he blamed the victim. As far as we're concerned, Judge Baugh has lost the trust of this community," Thompson said.

Yellowstone County Attorney Scott Twito said Baugh may lack authority to impose a longer sentence at this point. That's because state law says an illegal sentence must be handled through the appeal process.

Court documents show that Rambold and Moralez had three sexual encounters — once at school, once in his car and a third time at his home. The relationship was still going on when authorities were notified in 2008 after Moralez confided in her youth counselor, the court documents state.

"Law enforcement intervention ended the relationship, not the defendant," prosecutors said in an Aug. 23 sentencing memorandum.

Twito said last week that he was considering an appeal, and cited the two-year mandatory minimum requirement as grounds. He said he planned to be in Baugh's courtroom Friday but was unsure how the hearing might play out under the law.

"I've done this a long time and I'm in an area I have not been in before," said Twito, now in his 16th year as a prosecutor.

If his reading of the law stands up, that could give the defendant the advantage in Friday's hearing.

Baugh, 71, was first elected to the bench in 1984 and has been re-elected every six years since without an opponent. He's up for re-election in 2014.

Based on reporting by The Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino