(CNN) -- Saying outrage over his sentencing of a rapist to 30 days in jail could have been avoided "if I'd been more alert or if the state had pointed out" his error, a Montana judge confirmed that a higher court barred him from revisiting the sentence on Friday.
As part of that same decision, the state Supreme Court ruled that Judge G. Todd Baugh couldn't hold a hearing he had scheduled to reconsider the sentence.
Baugh had planned to reconsider the punishment after outrage over his initial sentence of a teacher who admitted raping a 14-year-old student. He explained Friday that he now understands that the conviction carried a minimum of 2 years in jail -- not 30 days -- and called Friday's hearing to address his mistake.
The high court order came shortly before this hearing on Friday, the judge said. After it did, Baugh said that he signed paperwork that -- over his objections -- sends the case on to the higher court.
"The appeal process will proceed forward, the Supreme Court will review the matter, and they will issue whatever orders they think are appropriate at that point in time," Baugh explained as to what will happen now.
In a strange twist to an already odd case, the defense and prosecution agreed that Friday's hearing should be called off -- albeit for very different reasons. Both sides questioned whether revisiting the sentence was even legal, with the defense saying nothing should change and prosecutors saying changing it could hurt their appeal.
They got what they wanted when the state high court vacated the hearing.
"We conclude that the stated intent of the District Court to alter the initially imposed oral sentence in today's scheduled hearing is unlawful and that the proceeding should be arrested," the court said. "We take no position on the legality of the imposed sentence and will address the parties' arguments in that regard on appeal."
Noting his office appealed to the state Supreme Court on Wednesday, Montana Attorney General Tim Fox cheered Friday's decision and the fact prosecutors "are moving forward with (the) process."
"The only way to ensure the rule of law prevails and justice is ultimately served is for my office to appeal the sentence," Fox said in a statement.
The defense, meanwhile, believes the sentence earlier announced in court by Baugh -- with all but 30 days suspended -- should stand.
In a response filed Thursday with the Yellowstone County Court, defense attorney Jay Lansing joined prosecutors in saying that the new hearing would be "without legal authority."
The case drew widespread attention when Baugh imposed the 30-day sentence on Stacey Dean Rambold and made controversial comments about the victim, saying she "seemed older than her chronological age."
Rambold admitted raping the girl while he was her teacher at her high school. Cherice Moralez took her life shortly before her 17th birthday.
In an order this week, the judge said it appears the mandatory minimum is two years, not 30 days. He said the court, "if necessary and appropriate," would amend the sentence at Friday's hearing.
Such a hearing, however, would "create confusion and uncertainty for all parties left to interpret and execute the sentence of Mr. Rambold," Lansing argued.
He said his client contends the sentence imposed, which prosecutors are appealing, is lawful and appropriate.
Prosecutors filed an emergency petition Thursday with the Montana Supreme Court, asking it to stop the scheduled hearing.
While acknowledging "the district court's effort to correct the error at the trial court level," they wrote that the "only remedy prescribed by statute and case law is appeal before this court.
"Further, the September 6 hearing, if permitted to be conducted, will undermine the State's appeal and otherwise frustrate the just and orderly administration of ordinary appeal processes," the petition read.
CNN's Eliott C. McLaughlin, Greg Botelho and Miguel Marquez contributed to this report.