BALTIMORE (AP) — During her first months in office as Baltimore's top prosecutor, Marilyn Mosby vowed to "deliver justice" on behalf of a black man whose death in police custody triggered massive protests and the city's worst riots in decades.

The state's attorney's swift decision to file charges herself against six officers involved in Freddie Gray's 2015 arrest put her in the spotlight. Some painted the youthful prosecutor as a courageous figure, while others believed she rushed to judgment or was cravenly opportunistic.

Now, more than three years after Gray's death, the most tumultuous saga in Baltimore's recent history is the lens through which many residents are viewing Mosby's re-election bid in a primary Tuesday.

"For a lot of individuals in the black community of Baltimore city, just seeing officers charged for this type of crime was really important," said Mileah Kromer, a Maryland pollster and director of a politics center at Goucher College. "I think she's going to be a very tough person to beat."

Mosby's 2015 gamble ultimately failed to get a single conviction. Three officers were acquitted; she dropped the three remaining cases. Still, Mosby, 38, is trumpeting her leading role in the Gray case, which came amid a nationwide outcry over policing and race.

A TV ad shows images of Mosby announcing charges against the officers. A campaign mailer sent this week stresses her decision to proactively charge officers, in contrast with counterparts elsewhere in the U.S. who also were dealing with high-profile deaths of black men during situations involving law enforcement.

Mosby's two Democratic rivals — both lawyers — face an uphill battle to edge out the tough-talking prosecutor with one of the city's most recognizable faces. No Republican is seeking the job.

There's a lot at stake: The state's attorney job is one of the few posts with power to tame Baltimore's scourge of violence.

Baltimore's eye-popping homicide rate began to climb immediately after Gray's death in April 2015. Last year, the mid-Atlantic city of 615,000 inhabitants tallied 343 killings, bringing the annual homicide rate to its highest ever: roughly 56 killings per 100,000 people.

"We have a crisis in Baltimore the likes of which our city has never seen: more murders, lower confidence in police and criminal justice than ever in our history," said challenger Thiru Vignarajah, 41, a former federal prosecutor and ex-Maryland deputy attorney general who's pledged to slash homicide totals in half over three years.

The rival many perceive as Mosby's tougher challenger is Ivan Bates, 49, a former assistant state's attorney and a defense lawyer. He's says he'll improve the relationship between prosecutors and police while ensuring repeat violent offenders don't get released.

"Are we safer now than we were three years ago? That answer is, 'No.' We need to restore confidence to a criminal justice system that's just not working," said Bates, who was endorsed by The Baltimore Sun.

While Baltimore's police union isn't endorsing anyone, it's clear it wants a change. Fraternal Order of Police President Gene Ryan has for years been scathing in his criticism of Mosby's leadership. When asked what might happen if she's re-elected, he suggested a doomsday scenario.

"If the revolving door (of criminals in the justice system) continues for another four years under her, I don't see Baltimore really surviving this," Ryan said in a phone interview.

Mosby, who's been endorsed by influential faith leaders and the likes of Democratic Maryland congressman Elijah Cummings, has repeatedly asserted that the partnership between prosecutors and police has been strong during her tenure. It's a claim Bates and Vignarajah dismiss as fiction.

Mosby has a knack for deflecting criticism. When she dismissed charges against the remaining officers in the Gray case, the chief prosecutor denounced the criminal justice system itself, portraying it as a rigged game. "We could try this case 100 times, and cases just like it, and still wind up with the same results," Mosby said then.

At a recent televised debate, Mosby ticked off some of the challenges that have tested her: extreme leadership instability in the police department, a high-profile police corruption scandal, and 2015's upheaval.

"When you look at all of the external challenges, my office has been resilient in the face of chaos," said Mosby, who touts felony conviction rates above 90 percent.

At the debate, strong feelings about the incumbent in the majority-black city boiled over. One African-American woman in the audience furiously interrupted Mosby's closing statement, shouting "You lie all day! You're done!" as she was escorted out.

Yet there's no shortage of voters backing Mosby — including many African-Americans who live in neighborhoods with a strong mistrust of city law enforcers due to years of discriminatory and unconstitutional policing. Her supporters see her as an individual who's not intimidated by police.

"She's young and energetic," said Raymond Johnson, an 86-year-old retiree who chose Mosby in early voting at a polling place on the fringes of chronically troubled West Baltimore. "But what I like about her most is she won't get pushed around."

___

Follow McFadden on Twitter: https://twitter.com/dmcfadd

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.