Twenty-five years spent as an FBI agent instilled in me an appreciation for American justice. One of its hallmarks is collegiality: Prosecutors and defense attorneys respect each other even as they vigorously make their cases in an adversarial system.

Collegiality also calls on defense attorneys to respect law enforcers, whose often thankless job is to find and arrest lawbreakers and ensure they appear in court at the appointed time.

But that can’t be said for a nonprofit public defender in the Bronx. The Bronx Defenders describe their mission as “radically transforming how low-income people in The Bronx are represented in the justice system and, in doing so, transforming the system itself.”

That sounds like a noble pursuit. But during these woke times, honorable and hateful can often become curiously commingled. To wit, the NYPD’s Police Benevolent Association recently tweeted a screen-grab of a Facebook post by a member of The Bronx Defenders, Deborah Lolai, who had blasted out a colleagues’ repugnant rewrite of headlines announcing the death of PO Brian Mulkeen in the line of duty.

Mulkeen, you’ll remember, was the Bronx-based cop killed by friendly fire amid a struggle with an armed gangbanger. The reprehensible “tweaked” headline? “NYPD Murders Another Black Man, Then One Of Their Own.”

This isn’t uncharted territory for the anti-cop legal-aid group, which has received tens of millions of dollars in taxpayer funding.

In 2014, two Bronx Defenders participated in the filming of a rap video titled “Hands Up” — a reference to the popular Black Lives Matter trope about a Missouri police officer “executing” a black teenager, Michael Brown.

President Barack Obama’s Justice Department later debunked the claim, after an exhaustive civil rights investigation that found that Brown was not, in fact, executed.

Filmed at the Bronx Defenders’ headquarters, the video glorified cop killings with images of men pointing handguns at officers. The lyrics: “Time to start killing these coppers.” The two public defenders, Ryan Napoli and Kumar Rao, eventually resigned, and the ­director of the agency was suspended without pay for 60 days.

Soon after the video was filmed, a Black Lives-inspired assailant assassinated two NYPD police officers, Wenjian Liu and Rafael Ramos, in their patrol car.

The rot extends to the legal-aid industry as a whole. Following the shooting of a police officer in Staten Island in September, the Legal Aid Society clumsily weighed in, criticizing officers in a separate incident in which a scofflaw pulled a gun and fired on police before being fatally struck by their return fire. The basis for their tone-deaf criticism? Officers didn’t do enough to “de-escalate” the situation with an armed assailant who shot at them, per the ­society.

Let that sink in for just a moment.

Cops for the most part don’t care about our heated political debates. They dutifully tune out the noise while performing their jobs heroically in an environment that encourages verbal baiting and even water-dousing. They are expected to accept it, remain numb to the unhinged attacks and still respond in a courageous and timely fashion to our 911 calls.

Our heroes can take the criticism. But what they can’t abide are defenders who are beneficiaries of lavish New York City indigent-defense-services spending — some $308 million budgeted for 2020 — and who act as anti-cop activists on the side.

Robust advocacy on behalf of clients is appropriate. But slandering and maligning the NYPD, a departmental model of restraint, should subject any taxpayer-funded organization and its agenda to additional scrutiny and oversight. It may even be necessary to withhold some precious public funding until defenders set their house in order.

It is long overdue for Mayor Bill de Blasio and the City Council to exercise the power of the purse. No more rewarding anti-cop hate.

James A. Gagliano, a retired FBI ­supervisory special agent, is a law enforcement analyst for CNN and an adjunct assistant professor in homeland security and criminal justice at St. John’s University in Queens. Twitter: @JamesAGagliano