State prosecutors on Wednesday appealed a 30-day sentence handed down by a Montana judge to a former teacher for raping a student who later killed herself.

The announcement came after District Judge G. Todd Baugh acknowledged on Tuesday that the jail term he imposed on Aug. 26 for the rape of the 14-year-old girl was probably far too lenient than state law allows and then set a resentencing hearing for Friday to review the matter.

“In this court’s opinion, imposing a sentence which suspends more than the mandatory minimum would be an illegal sentence,” Baugh wrote in his order.

But Chief Deputy Yellowstone County Attorney Rod Souza on Wednesday filed notice that it wants the resentencing canceled. Though “well-intentioned,” Souza wrote, the judge lacks the authority to take back his original sentence.

Attorneys for the state and Yellowstone County say a minimum of two years in prison for Rambold is mandated under state law, and that the judge himself lacks discretion to revise the jail term because state law requires sentences deemed illegal to be appealed — either by the state or by the defendant.

“We believe that the sentence Judge Baugh imposed on Stacey Rambold is illegal,” Attorney General Tim Fox said in a statement. “Using the means provided by state law, we are appealing his sentence and working diligently to ensure that justice is served.”

Defendant Stacey Rambold, 54, last week received 15 years in prison with all but a month suspended for his months-long sexual relationship with Billings Senior High School student Cherice Moralez.

After handing down the sentence, the judge received widespread condemnation for his comments that the victim was “older than her chronological age.”

Moralez’s mother, Auliea Hanlon, said through her attorney that she welcomed the attorney general’s involvement in the case.

“Mrs. Hanlon was horribly disappointed with the 30-day sentence and was, frankly, quite shocked,” said the attorney, Shane Colton. “She’s pleased that the county attorney’s office and attorney general’s office understands that the most significant date to be considered in this sentencing is Cherice’s birthday. She was 14.”

Rambold last week began serving his month-long term at the state prison in Deer Lodge.

It wasn’t immediately clear if prosecutors would seek to keep him in custody pending the appeal, which attorneys said could take between six and 18 months to work its way through the state Supreme Court.

Rambold’s attorney, Jay Lansing, did not respond to calls for comment.

The judge’s actions in the wake of the original sentencing have done little to sway his critics, including hundreds of protesters who rallied outside the Yellowstone County Courthouse last week to call for his resignation.

“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.

Whether Baugh’s comments about Moralez will become an issue during the appeal is not yet known.

“It would not be appropriate for us to preliminarily decide what we would or wouldn’t do with that aspect of the case,” Deputy Attorney General Mark Mattioli said. “At a minimum, the statement of facts in the brief would honestly convey what transpired in the case.”

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.

Baugh said in response to the criticism that followed his remarks that Rambold’s sentence was based on the defendant’s violation of an earlier deal he made with prosecutors, rather than the original crime. Baugh also said his remarks about Moralez were “irrelevant” and did not factor into his sentence.