NEW YORK - (AP) -- New York City Police Commissioner William Bratton is resigning his post atop the nation's largest police force.

Mayor Bill de Blasio announced Tuesday that Bratton will retire next month, and that James O'Neill, the department's top chief, will succeed him.

Bratton had said last month that he would not remain head of the NYPD past the end of de Blasio's first term in 2017.

Bratton's resume is unmatched in local law enforcement. He began his career as a patrolman in Boston in 1970 and went on to lead law enforcement agencies in Boston, Los Angeles and New York.

His current tenure at the NYPD was his second. In the first one under Mayor Rudolph Giuliani in the early 1990s, he was credited with driving down crime with a widely copied, data-driven, crime-fighting strategy before his brash style made him an annoyance to the mayor, who forced him out.

Though de Blasio was elected as a sharp critic of a police tactic that involved stopping and searching huge numbers of young black men, he picked Bratton as a sign that he would balance reform with further driving down crime.

On Bratton's watch, the NYPD has drastically scaled back its "stop-and-frisk" strategy, but stepped up enforcement against of so-called "quality of life" offenses. Critics said that approach still unfairly targeted minorities and came into play in the chokehold death of Eric Garner during his arrest for allegedly selling loose cigarettes on a Staten Island block. Garner, who was black, was unarmed; Officer Daniel Pantaleo, who put his arm around Garner's neck, is white.

Adding to a national wave of concern about police treatment of minorities, especially black men, Garner's 2012 death and a grand jury's decision not to indict Pantaleo sparked protests and tension between the Democratic mayor and rank-and-file officers who felt he took protesters' side.

Then Officers Wenjian Liu and Rafael Ramos were ambushed and shot dead by a gunman who had announced online he planned to kill police in retaliation for Garner's death. In an extraordinary display of scorn, officers turned their back on the mayor at a hospital on the night of the December 2012 killings and again at the officers' funerals.

Bratton found himself in the middle, calling the officers' gesture inappropriate but at the same time noting that it reflected officers' feelings about "many issues."

The tensions between the mayor and police eased, but officers have been under scrutiny this summer as concern about police-minority relations has welled anew here and elsewhere.

On Monday, Bronx state Assemblyman Michael Blake, who is black, filed an excessive-force complaint against the NYPD, saying an officer handled him roughly as Blake tried to defuse an argument between officers and residents. The department said that the officer perceived a possible threat to a sergeant when Blake placed a hand on his shoulder and that the officer had apologized.

As tensions between the police and minorities have grown, the mayor, were he to be re-elected next year, will likely be under pressure by his liberal allies to select a more progressive candidate, and likely a commissioner of color.

O'Neill, like Bratton and de Blasio, is white.