A former gym teacher who had sex with a 14-year-old student and sent him erotic cell phone messages was sentenced Wednesday to up to three years in prison, in part because she called the boy after she was charged.

The boy's family had been willing to settle for a sentence less than prison until they found out Beth Ann Chester had contacted him, prosecutor Laura Ditka told the judge.

Chester, 27, was led away in handcuffs after apologizing and pleading guilty to statutory sexual assault, corruption of a minor and criminal use of a cell phone.

"I know this is the punishment I deserve," she said of the 1 1/2- to 3-year prison sentence she received.

The boy was a freshman when Chester met him last fall at Moon Area High School. The ninth-grade teacher and volleyball coach resigned unexpectedly in December citing "personal reasons." She was arrested in early January after she confessed to having sex with the boy, including once in a school parking lot.

"We were obviously hoping for something less than jail, but there was undeniably an episode of contact there. She called him on the phone," defense attorney Robert DelGreco Jr. told The Associated Press. "The condition of her bond was there to be absolutely no contact with the boy."

DelGreco didn't excuse Chester's behavior, but sought to explain it by noting that her marriage was troubled when she met the boy. That caused her to become closer to her students than she should have been, DelGreco said.

"She treated them more as her classmates than a teacher-student relationship," DelGreco said.

Chester's divorce is pending.

Authorities said the boy and Chester began exchanging text messages in October after she got his cell phone number from a member of her volleyball squad. The boy told police he fell in love with Chester as their text messages and other contacts became more frequent. The two also exchanged nude pictures of each other.

The boy's parents found some text messages Chester sent the boy in December and confronted her. They agreed not to press charges if she resigned.

After Chester resigned, another teacher told the school's principal about the her relationship with the teen. School officials referred the matter to police.