Two Iowa high school students killed their Spanish teacher last year as retaliation for receiving a bad grade, prosecutors said in court documents on Tuesday.

The documents reveal a possible motive in the case for the first time since the teenagers — Willard Miller and Jeremy Goodale — were arrested in November 2021. The boys, who were 16 at the time, face murder charges for the death of their 66-year-old teacher Nohema Graber.

According to investigators, Miller had met with Graber on November 2, 2021, to discuss his poor grade in her class. The teacher drove later that day to a park where she was known to take daily walks after school. Witnesses reported seeing her van leaving the park less than an hour after she arrived with two males in the front seat.

The van was left at the end of a rural road and a witness later picked up the two boys as they walked to town on the same road, investigators said.

SUSPECT WHO FLED FROM IOWA OFFICERS DIES AFTER EXCHANGING GUNFIRE

Willard Miller (left) and Jeremy Everett Goodale (right) in court.

Willard Miller (left) and Jeremy Everett Goodale (right) in court. (Associated Press)

Graber's body was found at the park the next day underneath a tarp, wheelbarrow and railroad ties. She had been beaten to death with a baseball bat, according to investigators, and one of the teenagers bragged about the incident on social media.

In speaking to police, Miller said he was frustrated over Graber's teaching methods and how his grade in her class was lowering his GPA.

"The poor grade is believed to be the motive behind the murder of Graber which directly connects Miller," court documents filed by Jefferson County Attorney Chauncey Moulding and Assistant Iowa Attorney General Scott Brown stated.

Miller initially denied involvement in his teacher's death but later said he had knowledge of the events but did not participate and that a "roving group of masked kids" were the real killers, who forced him to give them his wheelbarrow to help move her body. He also claimed the alleged masked kids had him drive her van from the park, according to court documents.

IOWA MAN RESCUES 4 SIBLINGS FROM RAGING INFERNO AFTER MAKING WRONG TURN: ‘LIVES WERE SAVED HERE’

Nohema Graber

The two teenagers face murder charges for the death of their 66-year-old teacher Nohema Graber. (Fairfield Iowa Police Department via AP)

A witness provided photos to investigators of a Snapchat conversation with Goodale that reveals "Goodale's admissions that he acted in concert with another person to bring about Graber's death." The witness said Goodale made comments implicating himself and Miller by name.

But Miller's lawyer, Christine Branstad, claims four search warrants were issued illegally in part because "law enforcement failed to provide information to the issuing magistrate to show the informant is reliable or that the information from the informant should be considered reliable."

Goodale and Miller

Two Iowa high school students killed their Spanish teacher last year as retaliation for receiving a bad grade, prosecutors said in court documents on Tuesday. (Fairfield Police Department via AP)

CLICK HERE TO GET THE FOX NEWS APP

Branstad is asking the court to invalidate all four search warrants and suppress evidence from Miller's home, comments he made to police and information obtained from his cellphone and Snapchat.

Miller is scheduled for trial on March 20 and Goodale's trial is set for December 5. The teenagers, both 17, will be tried as adults.

The Associated Press contributed to this report.