One of two Iowa teenagers charged in the 2021 fatal beating of their Spanish teacher over a bad grade will cooperate with prosecutors, it was revealed Wednesday in court.

Jeremy Goodale has agreed to testify against his former friend Willard Miller, although it was not immediately clear if the arrangement is part of a plea deal, according to the Des Moines Register.

Jefferson County Attorney Chauncey Moulding made the surprising disclosure during a hearing in which Miller's lawyers argued that evidence against the pair should be suppressed because their constitutional rights had been violated.

IOWA TEENS KILLED SPANISH TEACHER, 66, WITH BASEBALL BAT, NEWLY RELEASED COURT DOCS ALLEGE

Jeremey Goodale and Willard Miller are shown in court wearing vests and orange shirts.

Iowa teenagers Jeremy Goodale, left, and Willard Miller are charged with first-degree murder for the slaying of Fairfield High School teacher Nohema Graber. (Nick Rohlman of The Gazette/Zach Boyden-Holmes of the Des Moines Register, both via AP)

"Mr. Goodale has turned state's evidence and is listed as a witness against Miller," Moulding announced, noting that Miller's lawyers should no longer make assertions on behalf of Goodale, the local newspaper reported.

The classmates, who are now 17, are charged with murdering teacher Nohema Graber, 66, on Nov. 2, 2021, after Miller had a meeting with her over a poor grade he received in her class, according to prosecutors. They are being tried as adults.

The pair, who were 16 at the time of the killing, are accused of ambushing the Fairfield High School teacher in Chautauqua Park, where she was known to take daily walks.

Nohema Graber holds an ice cream cone.

Spanish teacher Nohema Graber was allegedly beaten to death on Nov. 2, 2021, in Fairfield, Iowa, by two students over a bad grade in her class. (Facebook)

The teenagers allegedly dragged her into the woods and beat her to death with a baseball bat, court papers allege.

Her body was found the next day hidden under a tarp, a wheelbarrow and railroad ties, the documents say.

IOWA TEENAGERS ACCUSED OF MURDERING HIGH SCHOOL SPANISH TEACHER TO BE TRIED AS ADULTS

Graber had taught at the school, about 100 miles southeast of Des Moines, since 2012. 

The hearing Wednesday was on a motion by Miller to suppress interviews the two teenagers gave to investigators and other evidence.

Jeremy Goodale and Williard Miller wear face masks in court.

Goodale and Miller appear at the Jefferson County Courthouse in Fairfield, Iowa, on Nov. 23, 2021. (Zach Boyden-Holmes for the Des Moines Register via AP)

Miller has a pending appeal before the Iowa Supreme Court on the denial of a previous motion to suppress evidence on similar grounds.

CLICK HERE TO GET THE FOX NEWS APP

Miller is slated to go to trial on April 21 in Pottawattamie County, and Goodale in May.

The Associated Press contributed to this report.