A British man charged alongside former Northwestern University professor Wyndham Lathem in a gruesome 2017 murder has accepted a plea deal with Cook County prosecutors.

As part of a deal announced Monday, Andrew Warren, who had been set to go to trial next week, will testify for the prosecution against Lathem in exchange for a 45-year prison sentence. Warren, 58, will not be formally sentenced until after Lathem’s trial.

The pair are charged with the murder of Lathem’s 26-year-old boyfriend, Trenton James Cornell-Duranleau, who was found stabbed some 70 times in Lathem’s River North apartment.

Warren had given a videotaped confession after his arrest in 2017, and had since given a statement to prosecutors, Assistant State’s Attorney Craig Engebretson said Monday.

Wearing a dingy yellow jail jumpsuit, the hearing-impaired Warren glanced from the prosecutor to a monitor screen as Engebretson recited the details of the killing prosecutors expect to hear from Warren: that he and Lathem had plotted to murder Cornell-Duranleau in online messages exchanged over weeks, and that he flew to Chicago and brutally stabbed Cornell-Duranleau to death inside Lathem’s apartment.

Asked by the prosecutor if the summary of his confession was correct, Warren said, “Tis true.”

Seated in the courtroom gallery with a half-dozen supporters, Cornell-Duranleau’s mothers looked on with pained expressions as Engebretson recapped the evidence.

Prosecutors have earlier said the gruesome plan called for Lathem to stab Cornell-Duranleau to death while Warren filmed it on his cellphone camera; Warren then was to kill Lathem, then kill himself.

Warren has been jailed without bond since Lathem dropped him off outside a police station in San Francisco two years ago. Lathem surrendered to police in nearby Oakland soon after. No date has been set for Lathem’s trial.

Warren, a payroll clerk who worked for a branch campus of Oxford University, had flown to the U.S. on June 24, 2017, just three days before Cornell-Duranleau’s murder.

On Monday, prosecutors said Lathem began stabbing the sleeping Cornell-Duranleau as he lay in Lathem’s bed, and Warren helped by restraining the young man, hitting him with a lamp and stabbing him. At a previous hearing, prosecutors said Warren got two knives from the kitchen and began stabbing Cornell-Duranleau so forcefully that the blade broke off one of the knives.

The two suspects, apparently losing the nerve to carry out their suicide pact after killing Cornell-Duranleau, began a bizarre two-week trip as fugitives; the trip included stops at a Chicago health clinic and the public library in Lake Geneva, where they made large donations in Cornell-Duranleau’s name, prosecutors said.

Police discovered the body only after an anonymous call to the front desk at Lathem’s building; the caller said “a crime may have been committed” in Lathem’s room. Lathem allegedly also sent video messages to his family, as well as Cornell-Duranleau’s, in which he expressed remorse for betraying Cornell-Duranleau’s trust and making “the biggest mistake of my life.”

Lathem, 44, was a successful researcher on the faculty of Northwestern University’s Feinberg School of Medicine as one of the world’s top experts on the plague.

On Monday, Warren’s lawyer, Assistant Public Defender Bob Galhotra, said his client had the equivalent of a high school-level education in the U.K.