DES MOINES, Iowa (WHO/AP) — Two Iowa teenagers killed their high school Spanish teacher last year because of frustration over a bad grade, prosecutors said Tuesday in court documents that for the first time reveal a possible motive.

The documents were filed ahead of a hearing Wednesday where a judge will hear arguments on whether to suppress any of the evidence against Willard Miller and Jeremy Goodale, who are charged with murdering high school Spanish teacher Nohema Graber in the small town of Fairfield.

In those documents, the state lays out the evidence that led them to request the search warrant. Among that evidence are images of Snapchat messages sent from Miller to friends wherein he admits to the murder, prosecutors say.

A lawyer for Miller is asking the court in Fairfield to invalidate four search warrants and suppress evidence from Miller’s home, comments he made to police and information taken from his cellphone and Snapchat.

Graber’s body was found in a Fairfield park on Nov. 3, 2021, hidden under a tarp, wheelbarrow and railroad ties. She had been beaten to death with a baseball bat. Miller and Goodale were 16 at the time.

Fairfield is a town of about 9,400 people located some 100 miles (159 kilometers) from Des Moines.

Investigators found that Miller met with Graber at Fairfield High School on the afternoon of Nov. 2, 2021, to discuss his poor grade in her class. Graber later drove her van to a park where she was known to take daily walks after school, authorities say. Witnesses saw her van leaving the park less than an hour later with two males in the front seat.

The van was left at the end of a rural road. After getting a phone call from Goodale, a witness later picked up Goodale and Miller as they walked to town on that road, investigators say.

In a police interview, Miller described the frustrations he had with the way Graber taught Spanish and over how the 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 said.

Miller initially denied any involvement in Graber’s disappearance but “later stated he had knowledge of everything but did not participate,” according to court documents. He told police that the real killers — a “roving group of masked kids” — forced him to provide his wheelbarrow to help move her body and to drive her van from the park.

The documents say a witness provided photos of a Snapchat conversation “that identify Goodale’s admissions that he acted in concert with another person to bring about Graber’s death.” The witness identified Goodale as making statements that implicate both Goodale and Miller by name.

Miller’s lawyer, Christine Branstad, says that the 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.”

Miller is scheduled for trial on March 20 in Council Bluffs, Iowa, and Goodale’s trial is Dec. 5 in Davenport, Iowa.

Both teens, now 17, will be tried as adults. In Iowa, the penalty for a first-degree murder conviction is life in prison. Iowa Supreme Court rulings require juveniles convicted of even the most serious crimes to be given a chance for parole.

The Associated Press contributed to this report.