Updated

A former California middle school teacher is heading to trial after she admitted to having sex with a student she initially blamed for instigating the relationship -- and who later outed the married woman by posting nude photos of her online.

A judge ruled Tuesday that Justine Nelson, 30, will stand trial for allegedly engaging in sex acts with a 13-year-old boy she met in the hallway of Tenaya Middle School, KFSN-TV reported. Nelson was arrested in September 2016 and charged with multiple sex crimes.

FEMALE TEACHERS CHARGED OR CONVICTED OF HAVING SEX WITH STUDENTS

Police began investigating the former teacher after the eighth-grader posted nude photos of the woman on social media.

"[The student] said they were sexually naked pictures," Fresno police officer Malcolm Walls told KFSN-TV.

9cbd2622-Justine Nelson

Twitter

The teen told police he didn't have Nelson as a teacher and only started talking to her when she approached him last year.

"He said Mrs. Nelson walked up to him one day and asked him why he never talked to her, and said that he was cute," Walls said.

TEXAS ELEMENTARY SCHOOL TEACHER OF THE YEAR CHARGED WITH INAPPROPRIATE RELATIONS WITH A STUDENT

The teen claimed he and Nelson fooled around, initially kissing before it progressed to sex, until he turned 14.

Nelson admitted to investigators she had sex with the boy two or three times, but she said he initiated the acts, according to KFSN-TV. She also claimed the boy even threatened to ruin her career.

8b70551f-Justine Nelson

(Twitter)

But Nelson later changed her story, telling police she was sending notes to the student professing her love for him, according to KFSN-TV.

"He was scared," Walls said. "He wasn't sure he should say anything because Mrs. Nelson told him if he did it would ruin her family life and his sports career."

Nelson faces up to 14 years in prison if she’s convicted – though prosecutors must prove the student was 13 when the sex acts began. If not, she's set to face nine years in prison.