The judge in the retrial of Pedro Hernandez for allegedly killing Etan Patz ruled on Tuesday that jurors could consider another suspect’s incriminating statements for a “limited purpose,” even though he made them to an ex-prosecutor and two informants the defense didn’t call as witnesses.

State Supreme Court Justice Maxwell Wiley’s ruling followed an unexpected move last week by the defense to rest after FBI agent Mary Galligan testified secondhand about statements by child molester Jose Ramos, a longtime suspect, suggesting he had contact with Etan.

Ex-prosecutor Stuart GraBois and two informants testified about the statements at Hernandez’s first trial in 2015, which ended with a hung jury. The district attorney’s office said the move kept them from cross-examining the three, and urged Wiley to strike Galligan’s testimony.

The judge told jurors they couldn’t consider Ramos’ statements as direct evidence that he might be guilty instead of Hernandez, but could use them to assess “investigative steps” taken by Galligan, who was challenged by prosecutors over testimony that she thought Ramos was guilty.

Six-year-old Etan disappeared in 1979 in SoHo. Hernandez, a bodega worker in the Manhattan neighborhood at the time, confessed after a relative told police in 2012 that he might be the culprit. His defense is that his confession was a fantasy caused by a mental disorder, and Ramos is the real culprit.

Ramos surfaced as a prime suspect in the 1980s because of a social relationship with a woman who walked Etan to school.

He made statements to GraBois and the informants about an encounter with a boy on the day of Etan’s disappearance.

By relying on Galligan, a decorated FBI agent, without calling two fraudsters who were put in a cell with Ramos, prosecutors fear the defense may make its case appear stronger.

Wiley said he may still strike some limited testimony from Galligan’s testimony, preventing jurors from considering it at all. Closing arguments in the case are currently projected for the first week of February.