A Montgomery County high school music teacher who pleaded guilty to having a month-long sexual relationship with a female student was ordered yesterday to serve 18 months at the Montgomery County Detention Center and an equal amount of time on probation.

Circuit Court Judge Martha G. Kavanaugh, who imposed the maximum sentence of 10 years in prison and then suspended all but 18 months, told the defendant, James A. Misenheimer, 34, of Olney, that she had taught high school for seven years. She remarked that high school teachers are working with "vulnerable teenagers."

Kavanaugh said that she was "amazed" by the amount of "community support" for Misenheimer and that she felt compelled to "send a message to others" who work with youths. She also ordered that Misenheimer's name be placed on the state's registry of convicted sex offenders.

Misenheimer, who had asked Kavanaugh for leniency, stood silently but red-faced, his head down, as the judge pronounced sentence. He used a white handkerchief to wipe away tears. At the end of the hearing, he was led from the courtroom by sheriff's deputies and taken to jail immediately. The former vocal music teacher at Winston Churchill High School pleaded guilty in June to a single third-degree sexual offense for engaging in a one-month sexual relationship with a 15-year-old student this year.

He was arrested in February by Montgomery police after allegedly sending sexually charged e-mail to a 14-year-old female student.

Investigators searching through Misenheimer's office at the school found a sofa bed, condoms and sexual lubricant, "all the effects you'd have in an apartment," Alex Foster, assistant state's attorney, said at yesterday's sentencing.

Neither of the 15-year-old's parents was present at yesterday's hearing, and Foster said the parents did not want to "reexperience the details of the sexual assault of their daughter."

Defense attorney David C. Driscoll attempted to portray Misenheimer as a positive role model for young people, and he urged Kavanaugh to consider sentences handed down in similar cases.

Misenheimer, cleanshaven and wearing a dark gray suit, told the judge he took full responsibility for engaging in a sexual relationship with a minor.

"The school did not cause this. I cause this," he said.

"This time, I've crossed the line. I had control, and I crossed the line," Misenheimer said.