State prosecutors urged Maryland's high court to force a Baltimore policeman to testify against his fellow officers when they go on trial in connection with the death of Freddie Gray, a black man who suffered a fatal injury while in custody.

Prosecutor Michael Schatzow told a seven-judge panel at the state Court of Appeals that Baltimore City Circuit Court Judge Barry Williams improperly substituted his judgment for the government when he denied a request to compel Officer William Porter to testify against three officers.

Defense lawyers argued that the judge had properly rejected the prosecutors' motion as little more than a stall tactic.

Porter and five other officers face a variety of charges in the case. Gray, 25, suffered a fatal neck injury while being transported in a police van on April 12 and died one week later, setting off protests and later rioting on the day of his funeral.

Gray's death was one in a series of controversial killings of black men by police officers that sparked a wave of protests in cities including New York, Cleveland and Ferguson, Missouri, and propelled the Black Lives Matter movement.

Porter was the first officer to go to trial and testified in his defense. The trial ended with a hung jury in December and Porter is scheduled for retrial in June.

Williams had handed each side a partial victory on the testimony issue, prompting both to file appeals. He previously ruled that prosecutors could force Porter, 26, to testify against both Officer Caesar Goodson, who was driving the van and faces second-degree murder charges, and Sergeant Alicia White, one of his superiors.

But the judge also denied the state's motion to force Porter to testify against the other three officers - Lieutenant Brian Rice and Officers Garrett Miller and Edward Nero.

The first part of Thursday's hearing concerned the latter ruling and was largely focused on procedural issues: whether it is too soon for the state to appeal and whether Williams has the power under state law to contradict the government's finding that Porter's testimony is needed.

The second half of the hearing will address whether Porter, who was granted immunity to testify against Goodson and White, can nevertheless assert his right against self-incrimination.

The five officers' trials are on hold pending a decision from the court, for which there is no timetable.