Story highlights Judge says he gave "the right kind of sentence"

He apologizes for remarks about 14-year-old victim

She committed suicide before the sentencing

Montana attorney general appealing the sentence

A Montana judge is defending his decision to sentence a former teacher to 31 days in jail for raping a 14-year-old student.

Judge G. Todd Baugh said he gave 47-year-old Stacey Dean Rambold "the right kind of sentence:" 31 days in jail and more than 14 years on probation.

In his response to a complaint filed against him with the Montana Judicial Standards Commission, Baugh acknowledges making controversial remarks about victim Cherise Morales at Rambold's sentencing in August. According to the Montana Attorney General's Office, the judge said she looked older than her years and was "probably as much in control of the situation as was the defendant."

Morales committed suicide in February 2010.

"I am sorry I made those remarks," the judge wrote. "They focused on the victim when that aspect of the case should have been focused on the defendant."

Baugh said he weighed all relevant factors in passing sentence.

"The defendant's last legal or moral transgression was the crime he committed and admitted," he wrote. "In the ensuing almost six years, he had legally and morally good conduct, he was reinstated in sex offender treatment and the undisputed evidence supported community placement and treatment."

The length of the sentence, Baugh's comments and the age disparity between defendant and victim drew criticism and a firestorm of media attention.

Baugh filed his response on November 15. CNN obtained the document on Monday.

Baugh had kind words for Rambold. After Morales' death, the state offered to defer prosecution if Rambold agreed to undergo sex offender counseling and live under other restrictions.

"The defendant did the morally right thing in agreeing, even though the state did not think it could prove up its case," Baugh wrote.

Later, prosecutors decided to try Rambold because he missed counseling sessions and violated other rules. "Again, the defendant did the morally correct thing and did not challenge the violation," Baugh wrote.

Rambold had sexual relations with Morales in fall 2007, when she was 14 and a student in one of his classes at Billings Senior High in Billings, Montana. She confided in a church group leader and Rambold was charged in October 2008 with three counts of sexual intercourse without consent.

After the deferred prosecution deal fell apart, the state prosecuted, seeking 10 years imprisonment followed by 10 years' probation. The defense noted Rambold had already suffered by losing his job and getting divorced and asked for a 15-year sentence, with all but 31 days suspended.

Baugh went with the defense suggestion.