A Cook County judge Wednesday ordered former Chicago Police Detective Reynaldo Guevara to testify under oath about allegations he beat confessions out of two men who say they were wrongfully convicted in a 1998 double-murder.

After a hour-long hearing, Judge James Obbish ruled that Guevara – who has asserted his Fifth Amendment right and refused to answer questions about his interrogations of Gabriel Solache and Arturo DeLeon-Reyes – will take the stand in October to answer questions about the case under a grant of immunity from prosecutors.

Guevara will be subpoenaed to testify as soon as Oct. 17, in a hearing that will likely see the courtroom gallery filled with defense lawyers and civil rights attorneys who have clients who claim they were framed by Guevara during his three decades as a gang detective on the Northwest Side.

Prosecutors maintained that only Guevara’s testimony can refute Solache and DeLeon-Reyes’ claims that they were beaten by Guevara until they confessed to the murders of Mariano and Jacinta Soto, and an offer of “use immunity” will prevent state or federal prosecutors from using Guevara’s time on the stand as the basis for criminal charges against him— so long as Guevara does not lie under oath.

Solache claims that Guevara coerced his confession, then acted as translator when Solache gave a statement ins Spanish to a prosecutor.

“Only two people know exactly what Mr. Solache said,” during the 1998 interrogation and confession, Obbish said. “One is Mr. Solache, the other is Detective Guevara.”

Obbish said Guevara would have to answer questions put to him by prosecutors, and if Guevara continued to assert his Fifth Amendment rights on the stand despite prosecutors’ immunity pledge, the judge said he would take “appropriate action,” likely meaning he would find Guevara in contempt of court.

It still was unclear what Guevara might do. Guevara’s lawyer, citing the example of former Chicago Police Cmdr. Jon Burge’s prosecution for perjury, argued that despite the immunity deal, Guevara would be putting himself at risk of facing criminal charges no matter what he said on the stand.

“He can’t answer questions, and I can’t in good faith tell him to,” defense attorney Will Fahy said.

Fahy was concerned about the motives behind prosecutors’ offer of immunity, which he called “unprecedented.”

“What is the point of compelling him to testify at this point?” Fahy asked. “There’s something more in play here.”

Assistant State’s Attorney Alan Spellberg said the case against Solache and DeLeon-Reyes cannot be prosecuted without Guevara’s testimony. Prosecutors have said they believe Guevara.

“We are not trying to parade Detective Guevara, to blast him in front of the media, we are not trying to set him up for future prosecution,” Spellberg said. “We are trying to meet our burden (of proof) with the only witness available to us.”

Lawyers for Solache and DeLeon-Reyes have sought to have the two men’s confessions thrown in their bid to have the pair re-tried for the murders.

Guevara has been a central figure in several cases where defendants who landed in prison based on his detective work have been freed amid allegations of misconduct.