A high school teacher charged with eight felonies in connection with engaging in sex acts with students pleaded no contest Friday to a charge of unlawful sexual intercourse.

Amber Lee Failla faces a maximum of 16 months in prison at her May 7 sentencing, but prosecutor Marcus Cuper said the judge indicated Failla will be sentenced to a year in jail. Failla has agreed to lifetime registration as a sex offender.

"I think it's a just result for both sides," Cuper said. "The victims get some justice and she's not being overly punished."

Three charges of oral copulation with a person younger than 18, two counts of contacting a minor with the intent to commit a sexual offense, and two other counts of unlawful sexual intercourse were dismissed. Cuper said the latter two counts can be considered by the judge at sentencing.

Defense attorney Timothy Lemucchi said he also believes the plea deal is fair, especially in light of his client's background.

"She has a history of psychiatric problems," Lemucchi said.

Failla is bipolar, and Lemucchi said she was given a drug that has a side effect of making a person "hyperactively sexual." Lemucchi said Failla was the recipient of poor medical treatment in that she wasn't given a second drug to counteract those effects.

The attorney said Failla resigned from the Mojave Unified School District about a month ago.

"She's pretty emotionally distraught," Lemucchi said. "Fortunately her husband is her biggest supporter and is staying with her."

The California City High School math teacher engaged in sex acts with three students ranging in age from 14 to 17 years old, according to California City police. She also texted them nude photographs of herself.

The students told investigators Failla would text them at different times to meet in her classroom for sex when there was no class in session, police said. P

Police arrested Failla July 27 at her home in Tehachapi and seized computers and several cell phones.

Failla was 36 at the time of her arrest.