“I don’t want to hear none of her foolishness,” Ms. Jones said. “I want her to go forward and do her job, and at the end of the day, if she don’t do her job, I’m going to be very upset.”

Ms. Mosby, barred by a judge’s order from talking to the news media about the Gray cases, ran for office in 2014 vowing to combat police misconduct. That year, in a speech at Tuskegee University in Alabama, she had sharp words for prosecutors who had not indicted officers in the high-profile deaths of other black men, including Michael Brown in Ferguson, Mo., and Eric Garner on Staten Island. Mr. Gray’s death in April 2015 gave her a platform to make good on her promises.

“To the people of Baltimore and the demonstrators across America: I heard your call for ‘No justice, no peace,’” she said then, in a nationally televised news conference on the steps of the War Memorial. “Your peace is sincerely needed as I work to deliver justice on behalf of this young man.”

The spotlight, though, has had its challenges. Ms. Mosby is married to City Councilman Nick Mosby, who ran for mayor this year. He withdrew after failing to gain traction; many said Baltimore did not need two Mosbys in high offices. Their home has been picketed by protesters, who recently shouted down Ms. Mosby at a public meeting.

“As a mother of a 5- and a 7-year-old, I would appeal to them to stop coming to my house, because it’s scaring my children,” The Baltimore Sun quoted her saying at the meeting.

Legal experts have long said it will be difficult to obtain convictions against the six officers; the Nero case posed particular challenges. Prosecutors used it to test a novel theory: that the arrest of Mr. Gray was a crime. And the state’s star witness, Officer Garrett E. Miller, who is also facing charges and was compelled to testify, provided the evidence that in the end exonerated Officer Nero. All that raised questions about the prosecutors’ strategy.

In pursuing officers so aggressively, Ms. Mosby has risked her relationship with an important constituency: the Police Department itself, whose cooperation she needs to win convictions.