A US judge was blocked on Friday from increasing the controversial one-month jail term he imposed on a teacher convicted of raping a 14-year-old student.

Montana's Supreme Court said judge G. Todd Baugh could not annul the 31-day sentence he imposed on teacher Stacey Rambold for raping schoolgirl Cherice Moralez, who later committed suicide.

But the top tribunal did not rule on the sentence itself, which is expected to be appealed in a higher court, and changed to at least two years behind bars.

Baugh, who apologized after his ruling last month sparked protests nationwide, had planned a District Court hearing for Friday afternoon to void his sentence, with a view to imposing a longer prison term.

In a court order this week, the 71-year-old said his sentence was "illegal" because it ignored the compulsory minimum sentence of two years in jail.

But barely an hour before the scheduled hearing, the Montana Supreme Court ruled: "The stated intent .. to alter the initially imposed oral sentence in today's scheduled hearing is unlawful ... the proceeding should be arrested.

"We take no position on the legality of the imposed sentence, and will address the parties' arguments in that regard on appeal," added a six-member panel of judges, who agreed their ruling by four to two.

Baugh had sentenced Rambold to 15 years in prison for sexual intercourse without consent, after the teacher admitted raping Moralez. But he suspended all but 31 days of the sentence.

Critics slammed both the lenience of the sentence and the judge's comments in court that Moralez was "older than her chronological age" and "as much in control of the situation" as the now 54-year-old teacher.

"I don't know what I was thinking or trying to say," Baugh told the Billings Gazette," apologizing for the ruling, adding: "It was just stupid and wrong."

Moralez killed herself at the age of 17. Her mother said she believed the rape contributed to her decision to commit suicide.