A married former teacher accused of having sex with a 17-year-old student was found not guilty on all counts by a Maine jury Thursday.

A jury in Alfred deliberated for about two hours after a four-day trial during which Jill Lamontagne, a 30-year-old former health teacher at Kennebunk High School, denied having sex with the student — who is now 19 — in a classroom closet and in her home last year, as he testified earlier this week, the Journal Tribune reports.

Her attorney, Scott Gardner, had blasted the allegations as the “fantasy of a teen boy” that spiraled out of control.

“I am pleased that the truth worked,” Lamontagne said outside York County Superior Court after the verdict while flanked by Gardner and her husband, Steve.

A jury acquitted Lamontagne, who denied the allegations, on all 14 counts she faced, including unlawful sexual contact and sexual abuse of a minor. She testified in her own defense, telling jurors she helped the teen through a rough personal period and didn’t refer him to a school social worker because she expected that they wouldn’t get along, the Journal Tribune reported.

During cross-examination on Thursday, a prosecutor asked Lamontagne to explain nearly 100 text messages and 43 phone calls exchanged between her cellphone and the student throughout a six-month period, as well as a ride she gave the student without permission from his parents, according to the Bangor Daily News.

Lamontagne previously testified that she never gave the teen her cellphone number, but that he could’ve easily obtained it since she was a coach and adviser at the school. Lamontagne also detailed a meeting she had with the teen on Feb. 26, 2017, after he called her for help.

Lamontagne said the teen “had not showered” and had vomit on his shirt. She also denied his earlier testimony that they had sexual contact in her car that day, the Bangor Daily News reports.

A prosecutor also asked Lamontagne why she continued to help the boy after returning to the school in March 2017 after an initial investigation into rumors throughout the school of an illicit relationship. The probe led to no charges at the time, according to the newspaper.

“He had me convinced he wasn’t the one spreading the rumor, so he was a pretty good liar,” Lamontagne said of the teen.

Lamontagne’s attorney also questioned the veracity of the teen’s suicide attempt last June, when he was admitted to a hospital in Portland after ingesting a mix of medicines, including Tylenol, cold medicine and a blood thinner. The teen also told his mother and a nurse at the hospital that he loved Lamontagne, court documents show.

“This wasn’t a suicide attempt,” Gardner told jurors during closing arguments. “This kid was having a nervous breakdown. This was a psychiatric issue.”

Later, outside the courthouse, Gardner said Lamontagne had been “completely exonerated” and called on school officials to give her her job back, according to the Journal Tribune.

School officials, however, quickly threw cold water on any possible reunion with Lamontagne, saying the teacher’s actions still did not comply with district standards.

“The district respects the judgment of the jury and we commend the administrators, teachers and students who performed an important civic duty by responding to subpoenas from both sides and coming to court to testify,” RSU 21 Superintendent Kathryn Hawes said in a statement to the Journal Tribune. “We are glad that this long and difficult process is now over.“

But evidence presented during the trial showed Lamontagne’s actions didn’t follow district guidelines barring employees from communicating with students by text or on social media platforms. District officials would also “never condone the use of intimate language” like the kind shown during the trial between teachers and students, Hawes said.

Lamontagne’s former student, meanwhile, and his family declined to address reporters.