New York City Police Commissioner Bill Bratton stands with Mayor Bill de Blasio at a news conference where it was announced that Bratton will be stepping down in September on August 2, 2016 in New York City. (Credit: Getty Images / Spencer Platt)

Why did Bill Bratton leave the NYPD? And what will his legacy be?

In the end, Bill Bratton did what he has done in the past. After angling for the job of NYPD commissioner for more than five years (some say longer), he is staying only a little more than 2½ years.

As at the end of his first tour as commissioner two decades ago, his decision to leave the NYPD invites more questions than it provides answers. Just recently, he had repeated that he would remain until 2017.

So, why leave the NYPD now? Already there are competing narratives:

Did Bratton speed up his departure because of continuing disagreements with Mayor Bill de Blasio? (The latest incident: the mayor’s apology and Bratton’s refusal to apologize to Bronx Assemb. Michael Blake, who said police roughed him up.)

Did Bratton’s sudden announcement force de Blasio to accept Bratton’s protégé, Chief of Department James O’Neill, as his successor to avoid a prolonged national search that would have turned political?

Or did de Blasio simply have enough of Bratton?

We do know that the departure marks the end (for now at least) of the celebrity police commissioner. Bratton created this in the ’90s under then-Mayor Rudy Giuliani, dining nightly at Elaine’s on the Upper East Side with a band of merry men. There, he was embraced by the rich and famous and courted by the media.

One thing we can say about O’Neill, who last week said he’d rather be called “Jimmy,” is that unlike Bratton or former Commissioner Ray Kelly, he won’t be joining the elite Harvard Club.

So, what will Bratton’s second-term legacy at the NYPD be?

What he thought would be a victory lap after his CompStat and “broken windows” successes of the Giuliani era, instead became a minefield. But he reduced Kelly’s overuse of stop-and-frisk and continued the crime downturn.

At de Blasio’s lowest ebb, after the assassinations of Officers Rafael Ramos and Wenjian Liu, Bratton was a buffer between a mayor struggling to find his footing and an unforgiving NYPD rank and file.

Bratton’s future after the NYPD is unclear. He is taking a private-sector job and says he won’t return to policing. Still, the firm he’s joining has ties to Bill and Hillary Clinton, and Bratton backs Hillary for president.