TOP, FROM LEFT: Officers Caesar Goodson Jr., Garrett Miller and Edward Nero. BOTTOM, FROM LEFT: William Porter, Brian W. Rice and Alicia White. (Baltimore police)

The criminal case in the death of Freddie Gray has ended with the top prosecutor failing to convict any of the six police officers involved in the arrest last year that sparked riots in the city and fueled nationwide debate over fatal police encounters involving black men.

Facing a judge who repeatedly said there was insufficient evidence in the cases, the Baltimore state’s attorney, Marilyn Mosby, on Wednesday dropped criminal charges against three officers still awaiting trial. A judge found three other officers not guilty after separate trials in May, June and July.

After a brief court hearing, Mosby spoke in the West Baltimore neighborhood where Gray had been arrested and described her decision to drop the charges as “agonizing.”

The prosecutor conceded that Baltimore Circuit Court Judge Barry G. Williams “does not agree” with the state’s argument that officers committed crimes by failing to buckle Gray in the back of a police van in which he later fell and broke his neck. If the government continued with more trials, she said, prosecutors faced a “dismal likelihood of conviction.”

Baltimore State’s Attorney Marilyn Mosby held an impassioned news conference on July 27 to discuss the decision to drop all charges against three police officers awaiting trial in the death of Freddie Gray. Mosby brought criminal charges against all six officers after Gray suffered a fatal spinal injury while in police custody. (WUSA)

Mosby’s supporters described the prosecutor as courageous for taking on the police and said her decision accelerated the push for reforms in police tactics, oversight and management. Detractors who long accused Mosby of charging the officers to end rioting and advance her career called the outcome proof that the prosecution had been rushed and misguided from the start.

Gray’s death in April 2015 came after several other high-profile deaths of black men by police nationally, most notably in Ferguson, Mo., and in New York City. The cases prompted widespread protests.

Mosby, who took office in January 2015, was among the first prosecutors to file charges against officers after an in-custody death, amid complaints elsewhere that authorities were too slow to hold police accountable. She took on folk-hero status when she announced the move just two weeks after Gray’s death, taking the city and even police by surprise. More than a year ago, Mosby told a cheering crowd at a news conference turned rally, “I heard your cries for ‘No justice, no peace.’ ”

The divide between police and the black community has continued to widen with the recent police shootings of black men in Minnesota and Louisiana, compounded by attacks targeting police in Dallas and Baton Rouge leaving eight officers dead and others injured.

“Baltimore finds itself at the epicenter of a national conflict,” Mosby said Wednesday. “It is a struggle that strikes at the basic ideas of self-determination, justice, equality and, sadly, humanity in America.”

In many cities, the debate pits white officers against African American men. The Gray case is more complex, having occurred in a majority-black city with a black mayor, black top prosecutor and, at the time, a black police commissioner. Three of the officers involved in Gray’s arrest are black, as was the judge who oversaw the trials.

Six Baltimore police officers were charged after Freddie Gray’s death and arrest. On July 27, prosecutors dropped the remaining charges against three of the police officers awaiting trial. Here's a look at each of the officers. (Claritza Jimenez,Erin Patrick O'Connor/The Washington Post)

Police arrested Gray in West Baltimore the morning of April 12, 2015, after he ran from officers. Prosecutors argued that Gray never should have been arrested in the first place and that officers acted callously by failing to buckle him. He died in a hospital a week after the van incident. Defense attorneys countered that Gray was acting out and that it would have been unsafe for officers to enter the narrow van compartment.

Mosby defended her actions on Wednesday, saying that “however fitting it is for observers to use the untimely death of Freddie Carlos Gray as a barometer on police brutality,” she sought “justice on behalf of an innocent 25-year-old man who was unreasonably taken into custody after fleeing in his neighborhood, which just happens to be a high-crime neighborhood.”

Mosby also accused police of undermining — and in some cases impeding — the investigation by refusing to serve search warrants against fellow officers and making up memos to impugn key witnesses. The city’s police commissioner issued a statement defending the integrity of the investigation, saying 30 seasoned detectives “worked the case tirelessly to uncover facts.”

Attorneys and other advocates for the officers have defended the pursuit of Gray, a frequent target of arrests who ran from a high-crime area when he saw an officer.

Ivan Bates, who is an attorney for one of the accused officers and spoke at a news conference on behalf of the group, called Mosby’s prosecution a “nightmare.” He said the investigation was rushed and ignored findings by police who he said concluded Gray’s death was an accident rather than intentional or negligent homicide.

“When you quickly want to automatically say that these officers are guilty because they’re the police, then you perpetrate the fear that’s already there,” Bates said. “It is the Baltimore City state’s attorney’s office that has denied justice to the Gray family and denied justice to these officers.”

But Gray’s stepfather, Richard Shipley, who stood at Mosby’s side during her remarks, thanked her office for handling the case to “the best of their ability.”

He added, “We stand behind Marilyn and her prosecuting team, and my family is proud to have them represent us.” In September, Baltimore officials settled with Gray’s family for $6.4 million.

Though disappointed, Tessa Hill-Aston, president of the Baltimore branch of the NAACP, said the pressure brought through criminal charges attracted new attention to systemic problems long ignored. “There’s not closure,” she said. “There’s not justice. But there has been change and reform.”

Mosby’s announcement drew a subdued response on Baltimore streets.

Many protesters were resigned to the outcome after Williams found the van’s driver, Caesar Goodson Jr., the sole officer charged with murder, and Lt. Brian Rice, the highest-ranking officer in Gray’s arrest, not guilty. The other officers cleared were William Porter, Edward Nero, Garrett Miller and Sgt. Alicia White.

“I think she sent the police a message that needed to be sent,” said Harold Perry, 75, who lives on the corner where Gray was arrested, referring to Mosby. He joined dozens of people who came to hear Mosby speak, many of them chanting “We’re with you!” He said he had wanted to see some officers convicted but said Mosby had to drop the charges “because the judge battered down the evidence in the other trials.”

The officers still face administrative reviews for their conduct, which could result in discipline, and the U.S. Justice Department is expected to soon release a report on the practices of the Baltimore Police Department. Police Commissioner Kevin Davis called Mosby’s decision “thoughtful” and “wise,” adding, “Our criminal justice system has run its course.”

Mosby’s most damning accusation against police came when she said some detectives had obstructed the investigation. She alleged that “poignant questions” were not asked during interrogations and that detectives declined to serve warrants seeking text messages involving officers.

A prosecutor in court accused Dawnyell Taylor, at one time the lead detective in the case, of fabricating notes to indicate the medical examiner had initially planned to rule Gray’s death an accident, rather than a homicide. Taylor in turn accused a deputy state’s attorney of discarding evidence that did not fit the prosecutor’s narrative of the case.

Bui and Hermann reported from Washington. Dana Hedgpeth, Bill Turque, Keith L. Alexander, LaVendrick Smith and Arelis Hernández in Washington contributed to this report.