(CNN) -- Prosecutors in Montana are appealing a controversial 30-day sentence imposed on a teacher who admitted to raping his 14-year-old student.
The girl later took her own life.
In a Wednesday motion, Yellowstone County Chief Deputy Attorney Rod Souza argued the sentence was "illegal," and can only be corrected after an appeal to the Montana Supreme Court.
The filing came one day after the judge in the case filed a court order, admitting the sentence he imposed may have been against the law. He scheduled a new hearing for Friday, which Souza wants canceled.
"This is an illegal sentence. While well-intentioned, this sentence cannot be corrected by this court. If the case is to be re-sentenced, it can only occur after appeal to the Montana Supreme Court," Souza wrote.
Calls to the court and to the judge seeking comment on whether the hearing would go ahead were not immediately returned.
The case drew widespread attention when District Judge G. Todd 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."
In his order this week, Baugh said that it now 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.
"In this court's opinion, imposing a sentence which suspends more than the mandatory minimum would be an illegal sentence," read the order.
Rambold admitted raping the girl while he was her teacher at her high school.
Cherice Moralez was 14 at the time. She took her own life shortly before her 17th birthday.
The case began in 2008 when Cherice was a student at Billings Senior High School and Rambold, then 49, was a teacher.
School officials learned of the relationship, and Rambold resigned.
Authorities charged Rambold with three counts of sexual intercourse without consent.
As the case wound its way through the legal system, Cherice committed suicide.
With her death, prosecutors entered into what is known as a "deferred prosecution agreement" with Rambold.
This meant that all charges against Rambold would be dismissed if he completed a sex-offender treatment program and met other requirements. One of them was to have no contact with children.
Rambold admitted to one of the rape charges.
But the ex-teacher fell short of the agreement.
"He had some contacts with nieces and nephews in a family setting and other adults were present," Baugh said.
He also had relationships with women that he didn't tell his counselors about.
"That is a violation from his deferred prosecution so he was dropped from the plan," said the judge.
As a result, the case was revived in December 2012.
At a hearing last month, Baugh ruled that Rambold's infractions weren't serious enough.
"He made some violations of his treatment program," he said. "They were more technical and not the kind you would send someone to prison for."
He sentenced Rambold to 15 years in prison. Then, he suspended all but 31 days of the sentence, according to the Yellowstone County District Court.
The judge gave Rambold credit for one day he spent in jail.
Incredulous at what had happened, the victim's mother, Auliea Hanlon, shouted at the court, "You people suck."
"She wasn't even old enough to get a driver's license," Hanlon said in a statement released by her attorney. "But Judge Baugh, who never met our daughter, justified the paltry sentence saying she was older than her chronological age. I guess somehow it makes a rape more acceptable if you blame the victim, even if she was only 14."
CNN's Miguel Marquez contributed to this report.