Protesters, including Lee Patterson, right, gather outside the courthouse on what was to be the first day of the trial of Baltimore Officer Caesar R. Goodson Jr., charged in the death of Freddie Gray. (Jose Luis Magana/AP)

A judge ruled Wednesday that a city police officer awaiting retrial in Freddie Gray’s death does not have to testify against three of his co-defendants, a blow to prosecutors who had hoped a decision in their favor would allow them to postpone the case indefinitely.

The judge’s decision means the trials for the three officers who arrested Gray will move forward as a Maryland appeals court decides whether William G. Porter can be forced to testify against two other colleagues, police van driver Caesar R. Goodson Jr. and Sgt. Alicia D. White.

“As far as this court is concerned, we’re continuing,” Judge Barry G. Williams said.

Prosecutors have said that Porter, whose trial ended with a deadlocked jury in December, is a key witness against White and Goodson. But last week, the state said they want to use Porter as a witness against three officers involved in Gray’s arrest: Edward M. Nero, Garrett E. Miller and Brian W. Rice.

Porter’s attorneys have said forcing the officer to testify against Goodson and White would jeopardize his right to a fair trial, despite prosecutors’ promises that they would not use his testimony against him. The Maryland Court of Special Appeals is expected to hear the matter March 4.

Porter, who faces manslaughter and other charges, was present during five of the six stops a police van carrying Gray made in the city after the 25-year-old was arrested in April. Gray was gravely injured in the van and died a week later, sparking protests and later riots.

Prosecutors said forcing Porter to testify against Nero, Miller and Rice would allow them to show that Gray was not properly buckled into the van and subsequently suffered a severe spine injury.

“We think it is in the public interest to have his testimony,” Chief Deputy State’s Attorney Michael Schatzow said.

Attorneys for the officers argued that the state’s “disingenuous” request was an attempt to have all six trials postponed after legal wrangling over Porter’s forced testimony has upended prosecutors’ preferred trial schedule. If Porter were called as a witness against all the officers, every trial would be delayed as the appellate court weighs whether he should take the witness stand.

“They want to take him hostage for five cases and then torture him at his own trial,” Porter’s attorney Joseph Murtha said.

Williams ruled in favor of the defense, saying Porter is not a necessary witness in the trials of Nero, Miller and Rice. The judge also worried that the state’s request to call Porter in the remaining trials was a “ruse and subterfuge” to “get around the court’s ruling that these cases need to continue.”

Attorneys for White, Nero, Miller and Rice also objected Wednesday to any ruling that would delay their clients’ cases, saying it would violate their right to a speedy trial.

Here's what you need to know after a jury failed to reach a verdict in the trial of William G. Porter, one of six police officers charged in the ​Freddie Gray case​. (Ashleigh Joplin/The Washington Post)

Staci Pipkin, a Baltimore defense attorney and former city prosecutor, said postponing the entire case until Porter’s appeal is settled would have left the officers in limbo indefinitely, as subsequent lengthy appeals are likely.

“As a prosecutor, you always want to go in with your strongest case and the one most likely to get a conviction,” Pipkin said. “If your next two cases are your two weakest ones . . . [you] lose momentum.”

Goodson faces the most serious charge of second-degree depraved-heart murder. White and Rice face manslaughter and other charges, while Nero and Miller face assault and other charges. All of the officers have pleaded not guilty. The next trial, for Nero, is scheduled to start Feb. 22.