The judge who presided over Bill Cosby’s sexual assault trial on Wednesday ordered the public re­lease of the identities of the jurors who deadlocked in the case but warned them not to divulge what other jurors said during deliberations.

Judge Steven O’Neill granted a request by a dozen media organizations, including The Associated Press and the major TV networks, to release the names.

Court administrators revealed the identities of the 12 jurors who deliberated the case and the six alternates after relaying instructions from the judge on what they could and could not say if they spoke with reporters.

The judge declared a mistrial on Saturday after the jury deliberated for 52 hours without a verdict. Prosecutors plan to retry the 79-year-old Cosby on charges he drugged and molested a woman at his suburban Philadelphia home in 2004. Cosby said the encounter with Andrea Constand, a former Temple University employee, was consensual.

Lawyers for news outlets had argued that jurors’ names should be public to ensure transparency in the judicial process. Prosecutors and defense lawyers had argued they should remain secret, saying releasing them would make it more difficult to select a jury in Cosby’s second trial.

The judge cited the media’s First Amendment rights and Supreme Court precedent in ordering the release of the names. But he forbade jurors from talking about what other members of the jury said in the deliberating room or from revealing any votes cast in the case.

“Any disclosure of what was said and done during deliberations in this case would give a chilling effect upon the future jurors in this case and their ability to deliberate freely,” he wrote. “Further, future jurors will be reluctant to speak up or to say what they think when deliberating if they fear that what they say during deliberations will not be kept secret.”

The Associated Press tried contacting jurors for comment Wednesday but wasn’t immediately able to reach any of them.

The judge plans to hold Cosby's second trial in the next four months.

He ruled one day after a hearing at which the media outlets argued that jurors should be free to discuss their backgrounds, the sequestration process and their views, even if they do not disclose the jury split or other jurors’ comments.

“This is a critical part of the justice system,” the media outlets’ lawyer Eli Segal argued. “We are entitled to them.”

The jury was selected from the Pittsburgh area and spent two weeks sequestered 300 miles from home.

The AP does not typically identify people who say they are victims of sexual assault unless they grant permission, which Constand has done.