How did this happen? How did businessmen Jeremy Reichberg and Jona Rechnitz allegedly entice senior NYPD officials with dinners and trips to perform personal favors? The scandal has led to the indictments, transfers, modifications and/or retirements of a dozen police brass.

Virtually everyone has a theory for the NYPD’s ethical and moral breakdown, except perhaps Mayor Bill de Blasio, who in a speech to police academy graduates last week made no mention of the scandal. The breakdown is in part a result of the poor example set by police commissioners over the past 25 years.

It’s hard to imagine the scope of Bill Bratton’s accomplishments in two years during his first tour as commissioner in 1994. He and then-Mayor Rudy Giuliani reversed NYC crime increases, an overall reversal that continues today. Equally important, Bratton altered the culture of the NYPD, which had all but given up on fighting crime. He also altered the role of commissioner, transforming himself into a celebrity. He and other brass had a regular table at Elaine’s, the famed Upper East Side restaurant.

Bratton reveled in rubbing shoulders with the rich and famous. This included free trips and vacations paid for by prominent Wall Streeters. When the trips became public, Bratton wrote reimbursement checks for $12,000. Despite Bratton’s accomplishments, Giuliani used the trips to force his resignation in 1996.

Bratton’s successor, Howard Safir, also enjoyed mixing with the rich and famous. This culminated in 1999 with a jaunt to Hollywood with his wife to attend the Oscars paid for by George Fellows, then-president of Revlon U.S.A.

The trip occurred days after the fatal police shooting of Amadou Diallo in the Bronx. The City Council scheduled a hearing on the shooting the day after the Oscars, at which Safir was to testify. But Safir cited a “scheduling conflict.” When he was seen on TV at the Oscars, Giuliani ordered him home in time for the hearing. The Conflicts of Interest Board fined him the cost of the trip, $7,000.

With the city reeling from the 9/11 attacks, New Yorkers saw Safir’s successor, Bernie Kerik, as a savior and protector. Amid the adulation, Kerik accepted a rent-free apartment from a Manhattan Realtor and a suite paid by real estate moguls Paul and Seymour Milstein. Kerik was undone when he was nominated as secretary of Homeland Security and his past was exposed. He served 4 years in federal prison.

Succeeding Kerik, Ray Kelly was viewed by New Yorkers as the individual standing between the city and another attack. With Mayor Michael Bloomberg turning a blind eye, Kelly pressured the non-profit and supposedly independent Police Foundation to pay his membership dues, and expenses at the Harvard Club. Cost at the club for his 12 years as commissioner: about $40,000.

The Foundation was created after the Knapp Commission scandal of the 1970s as an anti-corruption measure to raise private donations for police work — not as a vanity charity for NYPD commissioners.

Last month, Bratton lectured the top brass on ethics. Perhaps he could lead by example and withdraw his own membership at the Harvard Club.