Progressive, reform-minded prosecutors have taken the reins in top local prosecutor roles across the country that have allowed them to begin to change the criminal justice system from the inside out.

These left-leaning Democratic district attorneys have sought reforms to the bail system, curbed enforcement of lower-level marijuana offenses, increased the use of diversion programs over jail time and pledged to end mass incarceration. They have also tried changing the culture in their offices, adjusting their prosecutorial priorities to upend a system they believe has contributed to the rise in prison populations.

And they've vowed to hold police accountable for alleged wrongdoing. Their platforms have been met with stiff opposition from some, particularly law enforcement organizations, advocacy groups and state and federal politicians and other prosecutors who have accused the reformers of being anti-police and who believe the changes will make citizens less safe.

Last week, Attorney General William Barr — who decades ago helped write a report arguing for more incarceration — told a Fraternal Order of Police conference in New Orleans that "the emergence in some of our large cities of district attorneys that style themselves as 'social justice' reformers, who spend their time undercutting the police, letting criminals off the hook and refusing to enforce the law," is "demoralizing to law enforcement and dangerous to public safety."

Rachael Rollins was elected district attorney in Suffolk County, Massachusetts, which includes Boston, in 2018 and is the first woman of color to be elected DA in the state.

Suffolk County District Attorney Rachael Rollins at a press conference in Boston on March 1, 2019. Craig F. Walker / The Boston Globe via Getty Images file

"Change never happens when people are comfortable," she told NBC News. "We're going to be thinking creatively about solutions." In her campaign, Rollins pledged to zero in on violent crime while effectively decriminalizing a host of nonviolent offenses, including shoplifting, larceny under $250 and drug possession with intent to distribute.

None of the prosecutors have faced as much pushback as hard-charging Philadelphia County District Attorney Larry Krasner, whose 2017 election was a watershed moment for the criminal justice reform movement.

Krasner, who is widely viewed as the nation's most progressive prosecutor, has routinely clashed with police groups and other law enforcement.

He has instructed his team to avoid prosecutions "where appropriate" to lower the incarcerated population, opting instead for a more liberal use of diversion programs. At the start of his term, he fired 31 prosecutors in the district attorney's office for their unwillingness to implement his changes and put 29 Philadelphia police officers on a "do-not-call list" — meaning they could not be considered credible witnesses at trials.

To some, Krasner is a hero. Others see him as a pariah. That was clear when, after the shooting of six Philadelphia police officers this month, William McSwain, the U.S. attorney for the Eastern District of Pennsylvania, lambasted Krasner in a statement tying him to the shootout.

"There is a new culture of disrespect for law enforcement in this city that is promoted and championed by District Attorney Larry Krasner — and I am fed up with it," said McSwain, a Republican who was nominated by President Donald Trump.

"We've now endured over a year and a half of the worst kinds of slander against law enforcement — the DA routinely calls police and prosecutors corrupt and racist, even 'war criminals' that he compares to Nazis," he added. "This vile rhetoric puts our police in danger. It disgraces the Office of the District Attorney. And it harms the good people in the City of Philadelphia and rewards the wicked."

Mike Neilon, a spokesman for the Philadelphia lodge of the Fraternal Order of Police, told NBC News "the perception of Larry has been that he's been soft on crime and has created a culture or a perception or an appearance that he's soft on crime."

Some Pennsylvania lawmakers tried to wrest away some of Krasner's authority last month, passing a law allowing for the state attorney general to prosecute certain gun crimes in Philadelphia, after Krasner had substantially increased the number of gun cases sent to a diversionary program.

Krasner declined to be interviewed, but Rollins said there has been a misrepresentation of her and her progressive colleagues.

"I think people conflate the fact that I want to be smart on crime when it comes to nonviolent, nonserious crimes, with the fact that somehow I'm not going to be hyper-focused on victims and keeping our community safe," she said. "I am very thoughtful about what we're doing at our municipal and district courts, but incredibly focused on getting accountability for victims of violent and serious crimes — overwhelmingly that are in poor communities and communities of color in Suffolk County."

She pointed to a decrease in crime in Boston since she took office. Earlier this year, Boston Police reported a 9 percent drop in overall crime in the city compared to the same period last year. In Philadelphia, homicides and gun crimes are trending up, although total violent crime has recently decreased.

Wesley Bell, a reformist prosecutor elected last year in St. Louis County, Missouri — where the 2014 Ferguson shooting took place — said "we see that the biggest impact on the justice system starts with the prosecutor's office."

St. Louis County Prosecutor Wesley Bell speaks during an interview on July 29, 2019. Jeff Roberson / AP file

"This is just too important for us to keep on the back burner and sweep under the rug as we've done for so long with respect to DA races across the country," Bell, the first black county prosecuting attorney in St. Louis County's history, said, adding that he and his colleagues are focused on "data-based, research-based policies that actually work."

Reformist DAs have sparked a "culture shift around what we've seen and heard with the possibility of what prosecutors can do," Brandon Evans, national political director for Real Justice PAC, a group that has seen eight of its endorsed candidates elected since 2017, told NBC News.

"There are some people who absolutely ... believe in the culture in over-policing and the culture of prosecution," Evans said, adding that "whether it be with the FOP, whether it be with the area sitting elected officials, there's still hostility toward" these progressive prosecutors.

The reformers form a tight-knit community, speaking often with one another and participating in panel discussions. Rollins, who said the group is "trying to think creatively about changing the status quo," said that she and Krasner have joked with each other about who will be the first to offer failed Queens district attorney candidate Tiffany Cabàn a job.

Queens district attorney candidate Tiffany Caban speaks to supporters in Queens, New York on June 25, 2019. Frank Franklin II / AP file

Cabàn, a public defender who lost her race in a close recount earlier this month, was the latest reformer to grab national attention. Cabàn ran on a platform that included decriminalizing drugs and sex work, ending cash bail, closing Rikers Island jail and not building new jails, and setting up a unit to review wrongful convictions.

"Trust me, we terrified the Democratic establishment," Caban said in her concession speech.

Bell, in St. Louis County, created a unit to investigate and possibly overturn some past convictions as it probes allegations of police misconduct. Rollins, too, has set up a similar team in Suffolk County.

Like others, Bell also has focused heavily on diverting people convicted of nonviolent crimes from jail to rehabilitation programs, which he said "not only brings our crime rates down, but most importantly, it helps people and families."

Anyone who wants to get into "this line of business" knows "there's going to be some opposition," Bell added.

Joe Gonzales, the Bexar County, Texas, criminal district attorney, told NBC News: "I believe the jail is for people that we're afraid of, not for people that commit minor offenses that are nonviolent."

"One of the reasons that I believe in the restorative justice is because punishment, like life, is gray," he said. "It's not just black and white. There's a lot of gray and there's a lot of opportunity for someone like me to give people a second chance."

Gonzales said the progressive prosecutor movement is gaining steam, adding, "You're going to see more reformers."