New York City Police Commissioner William J. Bratton announced that he plans to step down next month, probably marking an end to a 45-year career in public service.

New York City Mayor Bill de Blasio said Chief of Department James O'Neill, a commander who began his work as a transit officer in 1983, will take over as commissioner.

Bratton, 68, acknowledged that now is a "challenging time" for policing, but he said things were headed in the right direction.

Bratton said they were working on making a transition from "being the police to being your police."

"That is happening but it doesn't happen overnight," he said. "It is a sea change."

Bratton first became a beat cop in Boston in 1970. He rose to become Boston's police commissioner in 1980. He served as police commissioner in New York for the first time in the mid-'90s and then took the top job in Los Angeles from 2002 to 2009. Bratton was appointed police commissioner in New York once again in 2014.

Through the years, Bratton has been praised for bringing crime down in Los Angeles and New York. But more recently, the style of policing he made famous in New York 20 years ago has come under criticism.

"Broken windows" policing, as it is known, cracks down aggressively on low-level offenses in the hopes that it will deter bigger crimes. Critics say it disproportionately affects the poor and minorities. In an interview with NPR in 2015, Bratton defended his style.

"It's what made this city safe in the first place," he said.

Still, Bratton is stepping down at a time when policing is under the microscope nationally. Last fall, an inspector general found that Bratton's department "frequently failed to discipline officers who use force without justification." In response, the NYPD announced new rules regarding use of force.

Just yesterday, as The Guardian reported, a group affiliated with Black Lives Matter began occupying a park next to City Hall demanding that Bratton step down.

De Blasio praised Bratton, saying the commissioner had worked on two fronts: lowering crime and "righting some of the wrongs of the past." Bratton, de Blasio said, helped fix the stop-and-frisk policy and also helped heal some of the rifts between the police and the community.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.