A judge ruled that six police officers charged in the death of Freddie Gray will be tried in Baltimore, but this could be just the beginning of defense attorneys' efforts to move their trials out of town.

Despite the days of riots, protests and a multimillion-dollar settlement that followed Gray's death, a fair trial can be held in Baltimore for the officers, Baltimore Circuit Judge Barry Williams ruled Thursday. But the judge left the door open for defense attorneys to revisit their change of venue bid if an impartial jury cannot be seated in the city.

Legal experts say it's likely the defense will continue to ask for the trials to be moved outside of the city.

Gray was a 25-year-old black man who died after being critically injured while in police custody in April. Gray was handcuffed, shackled at the legs and put in a van after he was arrested, and officers ignored his repeated pleas for medical attention, prosecutors have said. Gray died April 19, a week after his arrest.

His death prompted protests and rioting that shook the city and caused millions of dollars in damage, and has since come to symbolize the broken relationship between the police and the public in Baltimore.

Attorney Ivan Bates, who argued on behalf of all six officers, said prosecutors and city officials have painted a very inaccurate picture of what happened to Gray and urged city residents not to rush to judgment.

"We ask you to listen to the entire story, and we ask you to honestly figure out what happened in that van," he said.

Local attorney Clarke Ahlers, who often represents police officers accused of misconduct, said the Baltimore officers have no right to appeal the pretrial ruling but added that the change of venue issue may arise again if a verdict triggers more rioting.

Ahlers said despite the court's efforts to weed out those with a bias, "the community has expressed such outrage and hatred of the police in this case, that there is no practical way to look into the mind of a potential juror and eliminate a person who simply lies to place him or herself on the jury," he said.

Andrew Levy, a Baltimore defense attorney and an adjunct professor at the University of Maryland School of Law, said picking a jury will be a challenge because while jurors may believe they can be impartial about a highly publicized case, they may also fear for their safety in the event of an acquittal.

"It's not just the concern that they've already formed an opinion in the case," Levy said. "In a way, they have a vested interest in the outcome."

Defense attorneys estimated the number of eligible jurors in the city at about 276,000.

The trials are tentatively scheduled to begin Oct. 13.

The six officers were indicted in May and face charges ranging from second-degree assault to second-degree murder. Three of the officers are white. Three are black.

Samuel Walker, a criminal justice professor at the University of Nebraska said it's hard to ignore the fact that this is the central event in the city since the spring.

"It's very likely that many people will have formed opinions. It's just a fact of life. I think keeping the door open for reconsideration is extremely important," he said.