(CNN) A Baltimore judge ruled Wednesday there will be separate trials for each of the six police officers charged in connection with the death of Freddie Gray .

The ruling represented a small victory for the defendants on a day that Circuit Court Judge Barry G. Williams earlier denied two key defense motions in the case -- one seeking its dismissal for alleged prosecutorial misconduct and another calling for prosecutor Marilyn Mosby to recuse herself.

Prosecutors had asked that three of the six officers be tried together; defense lawyers argued for separate trials for each

Williams said holding the trials together as the prosecution requested "is not in the interest of justice."

Wednesday's pretrial hearing came almost five months after Gray suffered a fatal spinal injury while being transported in a police van. Gray's death in April sparked days of unrest in a city of more than 600,000 people about 40 minutes northeast of the nation's capital.

More than a dozen attorneys for the six Baltimore police officers charged in Gray's death pressed the court to drop the charges -- and for Mosby to at least recuse herself. They said Mosby's office had issued orders for police to crack down on the area where Gray was arrested.

Andrew Graham, an attorney for Officer Caesar R. Goodson Jr., told Williams that Mosby was reckless and unprofessional by pressing for convictions in an attempt to restore order in Baltimore when she announced the charges in May.

Mosby's comments make a fair trial "impossible," said Graham, who likened the prosecutor's announcement of the charges against the officers to a "pep rally."

"She was urging everyone, including potential jurors, to exact vengeance," he said.

Chief Deputy State's Attorney Michael Schatzow told the court that Mosby, who was at Wednesday's hearing, merely read a probable cause statement when the charges were announced and did not press for convictions or comment on evidence.

The judge said that while he found some of Mosby's statement and actions "troubling," they "do not rise to the level" of having the charges dismissed outright or preclude the defendants from having a fair trial.

Williams called a defense argument "condescending" that sought Mosby's recusal because her husband, Nick Mosby, is a councilman in a district that experienced rioting. He said he also agreed with the prosecution's assertion that Mosby's reading of a statement of probable cause did not make her a witness in the case.

In announcing the charges , Mosby said: "Mr. Gray suffered a severe and critical neck injury as a result of being handcuffed, shackled by his feet and unrestrained inside of the (Baltimore police) wagon."

The six officers face charges ranging from assault to murder. All six have pleaded not guilty. The officers were not in court Wednesday.

The trials are scheduled to begin in October.

City on alert

Activists held protests at the Baltimore City Circuit Court's east courthouse, behind City Hall, and elsewhere Wednesday. About an hour before the hearing, some people gathered outside the courthouse, holding yellow signs calling for justice in Gray's case. Police reported one arrest, for assaulting a police officer and disorderly conduct, when some protesters tried to block a street near the Inner Harbor.

On Wednesday afternoon, Mayor Stephanie Rawlings-Blake and police officials commended both the police and protesters.

First sign of demonstrators at courthouse for first hearing of 6 officers accused in #FreddieGray death pic.twitter.com/nDRffyBwby — Miguel Marquez (@miguelmarquez) September 2, 2015

"Freddie Gray didn't have to die!" demonstrators shouted.

Baltimore police hope demonstrations will stay peaceful but are taking precautions in case they don't.

Size of protest growing.. Shouting No Justice No Peace #FreddieGray pic.twitter.com/0SZaRSQBpG — KnightfromABC2 (@Knightfromabc2) September 2, 2015

The police department canceled leave for officers Wednesday in case violence breaks out.

"We would rather err on the side of caution and have an abundance of people readily available as needed," Lt. Sarah Connolly said. "We are hoping we don't need them."

Photos: Baltimore protests Photos: Baltimore protests People hold hands during a rally at Baltimore City Hall on Sunday, May 3. The death of Freddie Gray, who died in police custody, sparked rioting in Baltimore and protests across the country Hide Caption 1 of 68 Photos: Baltimore protests Members of the National Guard board a truck at an armory staging area on May 3 in Baltimore. After a night of relatively peaceful protests, the city lifted a curfew , the National Guard is preparing its exit and a mall that had been a flashpoint in the protests has been reopened. Hide Caption 2 of 68 Photos: Baltimore protests Medics take a man away after police pepper-sprayed him on Saturday, May 2, in Baltimore's Sandtown neighborhood where Freddie Gray was arrested in April. Hide Caption 3 of 68 Photos: Baltimore protests Police detain a man on May 2 in Baltimore's Sandtown neighborhood. Hide Caption 4 of 68 Photos: Baltimore protests Protesters hold signs on May 2 in the Sandtown neighborhood. Hide Caption 5 of 68 Photos: Baltimore protests Protesters march from the Gilmor Homes housing community, where Freddie Gray was arrested, to City Hall on Saturday, May 2, in Baltimore. Hide Caption 6 of 68 Photos: Baltimore protests Police in riot gear enforce a 10 p.m. curfew and clear Baltimore streets of protesters and media on Friday, May 1. Hide Caption 7 of 68 Photos: Baltimore protests U.S. Rep. Elijah Cummings, D-Maryland, helps clear Baltimore streets of protesters on May 1. Hide Caption 8 of 68 Photos: Baltimore protests Demonstrators celebrate the announcement that six officers were charged May 1 in Gray's death. Hide Caption 9 of 68 Photos: Baltimore protests Demonstrators march through the streets of Baltimore after the charges against the officers were announced May 1. Hide Caption 10 of 68 Photos: Baltimore protests Police on horseback block a Baltimore street on May 1. Hide Caption 11 of 68 Photos: Baltimore protests A demonstrator celebrates in Baltimore the charges were announced on May 1. Hide Caption 12 of 68 Photos: Baltimore protests A member of the National Guard stands outside Baltimore City Hall as protesters gather on Wednesday, April 29. Hide Caption 13 of 68 Photos: Baltimore protests High school and college students march from Baltimore's Penn Station to City Hall on April 29. Hide Caption 14 of 68 Photos: Baltimore protests A community organizer later identified as Joseph Kent paces in front of riot police with his hands up during a curfew in Baltimore on Tuesday, April 28. Moments later, he was seen being arrested by police live on CNN . Kent's lawyer said on April 30 that his client had been released from jail. While some protesters defied the curfew and faced off with police, demonstrations Tuesday were largely peaceful. Hide Caption 15 of 68 Photos: Baltimore protests State Sen. Catherine E. Pugh embraces a protester while urging the crowd to disperse ahead of the 10 p.m. curfew. Hide Caption 16 of 68 Photos: Baltimore protests People attempt to stop protesters from approaching a police line on April 28. Hide Caption 17 of 68 Photos: Baltimore protests A Baltimore police captain tries to calm a protester on April 28. Hide Caption 18 of 68 Photos: Baltimore protests Two women sweep up the streets in Baltimore -- reflected in the broken window of a storefront on April 28. See more photos of the cleanup efforts. Hide Caption 19 of 68 Photos: Baltimore protests A band plays music during protests on April 28 in Baltimore. Hide Caption 20 of 68 Photos: Baltimore protests A boy in Baltimore offers water to a police officer on April 28. Hide Caption 21 of 68 Photos: Baltimore protests Jerrie Mckenny, left, and her sister Tia Sexton embrace as demonstrators hold hands and sing the hymn "Amazing Grace" in Baltimore on April 28. Hide Caption 22 of 68 Photos: Baltimore protests Demonstrators stand in front of a police line and call for peace after a bottle was thrown on April 28. Hide Caption 23 of 68 Photos: Baltimore protests Maryland National Guardsmen patrol the streets on April 28. Hide Caption 24 of 68 Photos: Baltimore protests The remains of a senior center smolder on April 28. Riots broke out Monday, April 27, after Freddie Gray's funeral Hide Caption 25 of 68 Photos: Baltimore protests Police retreat from burned-out cars in an intersection on Monday, April 27. Hide Caption 26 of 68 Photos: Baltimore protests Firefighters respond to a burning building during the riots late April 27. Hide Caption 27 of 68 Photos: Baltimore protests A police officer walks by a burning building on April 27. Hide Caption 28 of 68 Photos: Baltimore protests Police stand guard on April 27. Hide Caption 29 of 68 Photos: Baltimore protests Protesters climb on a destroyed Baltimore Police car in the street near the corner of Pennsylvania and North avenues on April 27. Hide Caption 30 of 68 Photos: Baltimore protests A mixture of milk and water rolls down a man's chest after he was pepper sprayed by the Baltimore Police April 27. Hide Caption 31 of 68 Photos: Baltimore protests A man rides a bicycle through heavy smoke emitting from a nearby store on fire April 27. Hide Caption 32 of 68 Photos: Baltimore protests A man shouts for calm as protesters clash with police April 27. Hide Caption 33 of 68 Photos: Baltimore protests Police carry an injured officer from the streets near Mondawmin Mall in Baltimore on April 27. Hide Caption 34 of 68 Photos: Baltimore protests People carrying goods leave a CVS pharmacy near Pennsylvania and North avenues on April 27. Hide Caption 35 of 68 Photos: Baltimore protests A demonstrator raises his fist as police stand in formation on April 27. Hide Caption 36 of 68 Photos: Baltimore protests Armored cars drive down Pennsylvania Avenue as looters break into shops on April 27. Hide Caption 37 of 68 Photos: Baltimore protests People lock arms and form a line opposing police at the corner of Pennsylvania and North avenues on April 27. Hide Caption 38 of 68 Photos: Baltimore protests Police form a barrier between protesters and a burning CVS being attended to by firefighters on April 27. Hide Caption 39 of 68 Photos: Baltimore protests People carry goods out of a CVS pharmacy on April 27. Hide Caption 40 of 68 Photos: Baltimore protests A police vehicle burns April 27. Hide Caption 41 of 68 Photos: Baltimore protests A police officer throws an object at protesters on April 27. Hide Caption 42 of 68 Photos: Baltimore protests A man carries items from a store as police vehicles burn on April 27. Hide Caption 43 of 68 Photos: Baltimore protests A police officer checks on a man who was injured on April 27. Hide Caption 44 of 68 Photos: Baltimore protests A police officer is carried to safety after being hit in the head with a rock during the riot on April 27. Hide Caption 45 of 68 Photos: Baltimore protests A police officer uses pepper spray on rioters on April 27. Hide Caption 46 of 68 Photos: Baltimore protests Police officers push back a protester on April 27. Hide Caption 47 of 68 Photos: Baltimore protests Police react during the riot on April 27. Hide Caption 48 of 68 Photos: Baltimore protests Baltimore police officers in riot gear look toward protesters near Mondawmin Mall on April 27. Hide Caption 49 of 68 Photos: Baltimore protests Baltimore Police Commissioner Anthony Batts chases away protesters in a parking lot on April 27. Hide Caption 50 of 68 Photos: Baltimore protests A woman abandons her car in the middle of an intersection as Baltimore Police officers clash with protesters outside the Mondawmin Mall in Baltimore on April 27. Hide Caption 51 of 68 Photos: Baltimore protests Police handle the protesters during a riot on April 27. Hide Caption 52 of 68 Photos: Baltimore protests A demonstrator taunts police on April 27. Hide Caption 53 of 68 Photos: Baltimore protests Protesters stand off with police during a march in honor of Gray in Baltimore on Saturday, April 25. Hide Caption 54 of 68 Photos: Baltimore protests A protester throws a barricade at a bar near Oriole Park at Camden Yards after a rally on April 25. Hide Caption 55 of 68 Photos: Baltimore protests Protesters chase after a car as it drives in reverse after the rally on April 25. Hide Caption 56 of 68 Photos: Baltimore protests A protester breaks a store window after the rally in Baltimore on April 25. Hide Caption 57 of 68 Photos: Baltimore protests Protesters get into a shoving match with police during a march downtown on April 25. Hide Caption 58 of 68 Photos: Baltimore protests Protesters and police square off April 25. Hide Caption 59 of 68 Photos: Baltimore protests Protesters drive through the Camden Yards area on April 25. Hide Caption 60 of 68 Photos: Baltimore protests Members of the Baltimore Police Department stand guard Thursday, April 23, outside the department's Western District station during a protest. Hide Caption 61 of 68 Photos: Baltimore protests A police officer films protesters from the steps of the Western District station on April 23. Hide Caption 62 of 68 Photos: Baltimore protests Empowerment Temple Pastor Jamal Harrison Bryant speaks in front of City Hall in Baltimore on April 23. Hide Caption 63 of 68 Photos: Baltimore protests Demonstrators put their fists in the air during a protest outside the Baltimore police's Western District station on Wednesday, April 22. Hide Caption 64 of 68 Photos: Baltimore protests Hundreds of demonstrators march toward the Western District station on April 22. Hide Caption 65 of 68 Photos: Baltimore protests People march through the streets of Baltimore on April 22. Hide Caption 66 of 68 Photos: Baltimore protests Demonstrators argue with Baltimore officers during the protest on April 22. Hide Caption 67 of 68 Photos: Baltimore protests A woman is comforted during the protest on April 22. Hide Caption 68 of 68

After Gray's funeral in April, Baltimore descended into chaos as buildings went up in flames and vandalism and looting devastated local businesses.

It was the exact opposite of what Gray's family had sought.

"I want y'all to get justice for my son," Gray's mother said at the time. "But don't do it like this here."

Officers and charges

• Goodson is charged with one count of second-degree depraved-heart murder, involuntary manslaughter, second-degree assault, manslaughter by vehicle (gross negligence), manslaughter by vehicle (criminal negligence), misconduct in office and reckless endangerment.

• Officer Garrett E. Miller is charged with one count of second-degree assault, two counts of misconduct in office and one count of reckless endangerment.

• Officer Edward M. Nero is charged with one count of second-degree assault, two counts of misconduct in office and one count of reckless endangerment.

• Officer William G. Porter is charged with one count of involuntary manslaughter, second-degree assault, misconduct in office and reckless endangerment.

• Lt. Brian W. Rice is charged with one count of involuntary manslaughter, one count of second-degree assault, two counts of misconduct in office and one count of reckless endangerment.

• Sgt. Alicia D. White is charged with one count of involuntary manslaughter, second-degree assault, misconduct in office and reckless endangerment.