The work of Louis Scarcella (c.) led to a slew of wrongful convictions, critics say.

A high-ranking NYPD official embraced one of the department’s most notorious ex-cops — and tweeted a picture to prove it.

Louis Scarcella, whose questionable policing tactics allegedly sent several innocent Brooklyn residents to prison, was honored on Wednesday at a Retired Detectives Association of New York dinner in Queens.

NYPD Chief of Detectives Robert Boyce shared a snap of himself with an arm around Scarcella and honoree Lt. John Russo while enjoying the festivities at O’Neill’s in Maspeth.

The photo enraged civil rights advocates.

“Boyce is giving the middle finger to criminal justice reformers, judges who have overturned wrongful convictions and most important to the dozens of men who have lost hundreds of years of life due to the misconduct of Louis Scarcella,” said lawyer Ron Kuby, who has represented a several people who claim Scarcella framed them.

Scarcella, a star of the NYPD during the crime-riddled crack-era of the 1980s, gained notoriety in 2013 when the Brooklyn District Attorney’s office opened an investigation into the former homicide detective’s cases.

The office’s Conviction Review Unit continued investigating over 90 homicide convictions related to Scarcella and allegations of rigging of evidence.

To date, the unit has vacated five of the cases, but maintain the tainted detective has not broken the law.

“People of unquestioned integrity, that understand the work that Detective Scarcella did, came together to honor him last night,” said Scarella’s attorneys, Joel Cohen and Alan Abramson.

An NYPD spokesman said Boyce was only at the event out of respect to Russo, whose work led to an arrest in the murder of Howard Beach jogger Karina Vetrano.

“Great night at the Retired Detectives of NYC dinner. Congratulations to the honorees,” the snap sent out by Boyce was captioned.

Jabbar Washington opens a bottle of Moet champagne this past July as he celebrates his first hour of freedom after spending 21 years in prison. Detective Louis Scarcella was named as an active participant in his wrongful conviction for a 1995 murder.

(Jesse Ward for New York Daily News)

Kuby said there’s no excuse for Boyce’s behavior.

“Either he didn’t understand the optics of what he was doing, in which case he has no business being chief of detectives, or he did understand and just decided to tell New Yorkers that he doesn’t care,” he added.

Kuby represented two men — Shabaka Shakur and Jabbar Washington — who were found to be wrongfully convicted by a Brooklyn supreme court judge and the DA’s Conviction Review Unit, respectively.

Washington, 43, who spent 21 years behind bars for a 1995 murder, was freed in July after the CRU named Scarcella as an active participant in his wrongful conviction.

Scarcella, who obtained Washington’s confession and helped conduct a lineup, suggested at trial he was identified as a suspect even though a witness recanted, prosecutors said.

Shabaka Shakur is hugged by his joyful wife, Lanette Holmes, near the Shawangunk Correctional Facility on June 8, 2015. Shakur spent over 27 years in prison for a double murder before he was released when a judge ruled that his confession might have been fabricated by Scarcella.

(JB Nicholas for New York Daily News)

Prior to the event, the Families of the Wrongfully Convicted blasted the association for honoring Scarcella.

“You don’t honor a man for his career in the NYPD, while ignoring the horrible results of his actions,” said Lonnie Soury, a spokesman for the group. “What an insult to all of those innocent men and women and their suffering families who have been wrongfully convicted.”

Earlier this month, retired Detective John Wilde, a member of the fraternal association, defended Scarcella.

“Louie has suffered in the papers and in his personal life. But for this one night, he can be proud to have worn the shield,” Wilde told the New York Times.

Scarcella, whose father and brother were both members of the NYPD, retired in March 1999 from the Brooklyn North Squad after 25 years on the job.

“If retired Detective Scarcella’s peer group wants to render some emotional support and that ruffles a few feathers that’s too bad,” said Michael Palladino, the president of the Detectives’ Endowment Association.