Nicole Dufault, a 40-year-old ex-New Jersey high school teacher, who had been accused of having sexual contact with six male students, has pleaded guilty to multiple counts of criminal sexual contact, according to NJ.com.

Originally she had pleaded not guilty.

Dufault agreed to the deal on three counts of aggravated criminal sexual contact just days before her trial was set to start. Jury selection had begun on Tuesday. 

The plea deal includes a recommended five-year state prison sentence, along with the forfeiture of her teaching license. She'll also have to register as a sex offender and deal with parole supervision for the rest of her lifetime. 

The then-35-year-old Dufault had been arrested back in 2014. Prior to that she had taught language arts for nine years. Authorities claim that she had sex with students on school property and in her car on multiple occasions over 2013 and 2014. Those students were 14 and 15-years-old.

After those charges were originally filed more students came forward. In total she was facing a 40-charge indictment for aggravated sexual assault and endangering the welfare of a child. She had reportedly been caught on tape with at least one of her accusers.

Timothy Smith, an attorney for Dufault, put up a defense in which he said that she was the victim because she had brain surgery that left her vulnerable to her students. He had argued that his client was a sufferer of "frontal lobe syndrome," which left her unable to control impulses. 

The next step for Dufault will be her sentencing, which will take place on June 8.

“We believe this is an appropriate resolution," Assistant Prosecutor Eric Plant said in a statement. "We hope that it will deter other individuals entrusted with the welfare of children from engaging in similar acts and ensures the public’s safety by requiring Ms. Dufault to register as a sex offender and forfeit her employment as a teacher in this state.”

Also Watch