(CNN) — The leader of the nation’s largest police department is stepping down.

New York Police Commissioner William Bratton, who served in the same role in the 1990s, is resigning, according to two city officials.

Last week, Bratton announced that he would step down in 2017.

James O’Neill, who rose through the ranks to become the NYPD chief of department, will be the next commissioner, according to the officials.

It’s unclear why Bratton, who has also led police departments in Los Angeles and Boston, is resigning now after retaking the NYPD helm in December 2013. When he returned, crime rates were low, but tensions with the community were high because of his predecessor’s controversial stop-and-frisk policy that critics said targeted minorities.

Bratton wasn’t forced out. He has told friends that he intended to stay about two years and is leaving on his own accord, two city officials said.

According to the officials, Bratton is departing on a high note, with crime rates declining, relations with the community improving and the rank and file better trained and equipped than ever before.

At a news conference last week, Bratton reiterated that he had no intention of staying on the job if Mayor Bill de Blasio sought a second term.

“It’s never a good time to leave something you love doing, but there’s a right time,” he said. “But when I find the right time, that’s when I’ll have the consultation with the mayor and decide to go.”

De Blasio, at the same news conference, praised Bratton and said he and the police commissioner are “truly unified in our vision for safety in this city.”

“As long as I’m mayor, I welcome him to continue as commissioner,” de Blasio said.

Bratton’s time at the NYPD

Bratton is credited with pioneering the NYPD’s CompStat, a command and accountability system that employed real-time intelligence, rapid deployment of resources and accountability systems in police work.

He also was in charge of the NYPD during the largest crime reduction in New York City’s history, de Blasio said at the time of Bratton’s return as commissioner in 2013.

Under Bratton’s leadership in the mid-1990s, felony crime in New York City fell by 39%, city officials said.

Bratton also led the Los Angeles Police Department, helping bring about a 26% decline in violent crime in his first three years in the top job. By 2009, the crime rate was 54% lower than it had been during his predecessor’s final year. He also was praised for improving the LAPD’s relationships with the city’s many diverse communities.

Bratton also was chief of the New York City Transit Police and Boston police commissioner.

“In life … if things are going well, it’s never a good time to leave, but there’s a right time,” Bratton said last week. “And whether it’s personal life, professional life, that’s something in my life I always try to do.”

When Bratton was introduced as New York City police commissioner for the second time in late 2013, the law enforcement veteran held up a children’s book with the title, “Your Police.”

“We must always remember that whenever you see a policeman, he is your friend,” said Bratton, reading a passage from a book he first checked out of the library 56 years ago.