By Mike Hellgren

BALTIMORE (WJZ) — Uncharted territory. Officer Caesar Goodson’s trial is just days away. And now, Officer Porter may be the star witness.

The judge overseeing all the cases made several critical rulings in the case Wednesday.

READ MORE: Daughter Of Keith Smith Testifies, Says Her Father Killed His Wife Jacquelyn

WJZ Investigator Mike Hellgren with the rulings and what they mean in this high-profile case.

Judge Barry Williams will force Officer William Porter to testify against Officer Caesar Goodson Jr. and Sergeant Alicia White.

His bombshell decision is a huge victory for prosecutors and a blow for Porter, whose defense claims compelling him to take the stand violates his constitutional rights.

“He’s a witness, but he’s also a defendant, which makes the whole thing very novel and very unusual,” said Warren Alperstein, lawyer and courtroom observer.

“The goal is for the public to learn the truth about what happened to Freddie Gray,” said Doug Colbert, University of Maryland law professor.

Prosecutors granted Porter only a very limited immunity. They won’t use his new testimony against him.

READ MORE: ATF Offering $5K Reward For Information On Case Of Man Who Was Fatally Shot, Burned Inside Car; Person Of Interest Sought

That immunity does not cover possible federal prosecution.

“It is a major gamble, but the state is not in the best position here,” said Warren Brown, lawyer and courtroom observer.

The judge admitted he found himself in uncharted territory, that this has never been done before. He also said he understood the arguments of Porter’s attorneys that this could prejudice their client in his retrial.

Porter’s attorneys plan an immediate appeal.

It comes just days before Goodson is set to face trial in the death of Freddie Gray. Goodson faces the most serious charge — second-degree murder.

The judge also ruled Goodson’s trial will stay in Baltimore, jurors will be anonymous but not sequestered, and he left open the possibility jurors could hear about Freddie Gray’s medical history and past arrests.

“What’s never happened before is to prosecute police officers. There’s been four convicted police officers in the last ten years throughout the country,” Colbert said.

MORE NEWS: Anne Arundel County Police Officer Suspended Over 'Domestic-Related Incident'

If Officer Porter does not testify against Officer Goodson, he could find himself in contempt, and in jail.