Baltimore's top prosecutor won her Democratic primary Tuesday, assuring her of a second term despite criticism over what critics say was her botched 2015 prosecution of six police officers in the death of a black man named Freddie Gray.

The victory effectively hands the job of state's attorney to Marilyn Mosby because the city is dominated by the Democratic Party and no Republican filed to oppose her.

Mosby, 38, had to fight off concerns about her handling of the prosecution of six police officers, who faced charges after Gray, 25, died April 19, 2015, one week after suffering a spinal cord injury while being transported in a police vehicle following his arrest for possessing what was said to be an illegal knife.

The death of Gray triggered riots and protests, as many members of the community believed that rough treatment by police had contributed to his death.

Mosby quickly declared that the officers who transported Gray would face charges, prompting critics to assert that she had rushed the charges in part to quell the riots.

Ultimately, none of the six was convicted, leading some to question whether the tough-talking prosecutor, with only months on the job, had enough experience to tackle such a high-profile case.

Yet during this year's primary campaign, Mosby trumpeted about her leading role in the Gray case, despite not being able to convict any of the charged police officers -- gathering support in neighborhoods where residents mistrust the police.

In January, five out of six police officers unsuccessfully prosecuted by Mosby – Lt. Brian Rice, Sgt. Alicia White and Officers Edward Nero, Garrett Miller and William Porter – filed a lawsuit in civil court against Mosby for malicious prosecution.

“Honestly, she had my vote when she charged those police. Nobody is above the law, and when she charged them it made me feel like more of a citizen." — A Baltimore resident

They argued that the state's attorney didn’t have strong evidence and charged them only in a bid to ease the riots, the Baltimore Sun reported. The suit was blocked in May by a federal appeals court.

Still, Baltimore residents expressed overwhelming support to Mosby, precisely over her role in the case.

“Honestly, she had my vote when she charged those police. Nobody is above the law, and when she charged them it made me feel like more of a citizen," one resident said.

"If the Baltimore city police doesn't like her for charging their officers, then she's definitely my candidate," another voter said.

Mosby beat two other Democratic challengers, Ivan Bates and Thiru Vignarajah. Both attacked Mosby for her actual record and questioned her decisions during the 2015 events. The two also pointed out that the rate of homicides in the city has been soaring under her watch.

But she countered the criticism, saying her office had a high felony conviction rate – 92 percent – and that her prosecutors went after violent criminals.

It’s expected that Mosby’s key challenge during the second term will be tackling the soaring homicide rate in the city while repairing the relationship with the city police.

The Associated Press contributed to this report.