William Porter (right), one of six Baltimore city police officers charged in connection with the death of Freddie Gray in 2015, walks to a Baltimore courthouse with his attorney Joseph Murtha, Nov. 30, 2015. Rob Carr/Getty Images

A judge on Wednesday rejected prosecutors' request that a Baltimore policeman facing retrial over the death of black detainee Freddie Gray be forced to testify in the trials of his fellow officers.

Baltimore City Circuit Court Judge Barry Williams said the motion by the state compelling testimony by Officer William Porter appeared to be a "stall tactic" since it would have indefinitely postponed the trials of all six officers charged in Gray's death last April.

The 25-year-old West Baltimore man died from a broken neck suffered in a police van. His death triggered protests and a day of rioting and stoked a U.S. debate on race and policing.

Joseph Murtha, Porter's attorney, told Judge Williams the prosecution wanted to "take him hostage in five cases ... they want to torture him in his own trial with the threat of perjury."

Porter was the first officer to be tried, but his trial on involuntary manslaughter and other charges ended in a hung jury last month. A retrial is set for June.

Prosecutors had said Porter was a key witness against Officer Caesar Goodson, the van's driver, and Sergeant Alicia White.

Goodson's trial on a second-degree murder charge had been set to begin last week, but was delayed as Maryland's Court Of Special Appeals considers Porter's legal bid to block Williams' order that he testify for the state.

White's trial had been set for Feb. 8, but was also stayed pending a ruling by the appeals court.

The trial of Officer Edward Nero for Feb. 22 will go on as planned. Those of Officer Garrett Miller and Lieutenant Brian Rice are scheduled for March 7 and March 9, respectively.

Lawyers for Nero, Miller and Rice had objected to prosecutors' filings last week to compel Porter to testify in their trials. They had said that prosecutors wanted to avoid trying their weakest cases first.

Williams had granted the prosecution's request to give Porter a type of limited immunity in which his testimony could not be used against him, but the charges would still stand.

(Additional reporting by Ian Simpson, editing by G Crosse)