BALTIMORE — The state’s attorney here dropped all remaining charges Wednesday against three city police officers awaiting trial in the death of Freddie Gray, closing the book on one of the most closely watched police prosecutions in the nation without a single conviction — and few answers about precisely how the young man died.

The announcement ended a sweeping, deeply polarizing prosecution that began last spring, as National Guard troops rumbled through the streets, with Baltimore under curfew and residents tense after looting and riots that broke out after Mr. Gray sustained a fatal spinal cord injury in police custody.

Mr. Gray, a 25-year-old black man, had been arrested after he spotted a police presence as he walked with friends and ran away. He was found unresponsive and not breathing after he rode unsecured in a police transport wagon after his arrest on a bright morning in April 2015, and died a week later. Six officers were charged with crimes including manslaughter and murder; the first trial ended in a hung jury, and three more officers were acquitted after trials before a judge.

Wednesday’s extraordinary turn put into sharp relief the wrenching national debate over race and policing, after a month of deadly shootings of black men and deadly retaliations against police officers around the nation. Just a few weeks ago, President Obama pleaded for racial healing after five police officers in Dallas were gunned down by a black Army veteran. The outcome also left the city deeply divided over whether its top prosecutor, Marilyn J. Mosby, 36, had overreached in her initial charges.