Scandal-scarred ex-NYPD Detective Louis Scarcella landed back on the witness stand Friday — this time for his work in a 1998 murder case that led to the conviction of a man who claims he was framed.

Nelson Cruz had just turned 17 when he was arrested for the murder of Trevor Vieira in East New York. He is accusing Scarcella and his then-partner, Stephen Chmil, of forcing him to sign a false confession and getting a witness to lie that Cruz was the shooter.

At a hearing that could result in Cruz’s conviction getting overturned, Scarcella repeatedly said he couldn’t remember the details of the case.

“Do you remember being present in the precinct after Mr. Cruz’s arrest?” defense lawyer Justin Bonus asked in Brooklyn Supreme Court.

“No, sir,” the longtime retired detective replied, as his lawyer, Joel Cohen, lingered next to him.

Bonus continued, “Do you remember being present during the lineup that was conducted with Mr. Cruz?”

Scarcella again said, “No, sir.”

So far, eight convictions involving Scarcella — who was a star hom­icide detective in the 1980s and ’90s — have been overturned by the Brooklyn DA’s Conviction Review Unit. Another six were tossed on defense motions, some led by the nonprofit Innocence Project.

Those cases involved scathing allegations that Scarcella relied on coerced confessions, falsified evidence and testimony from a crack-addled prostitute to solve some of the biggest homicides of that time.

A review by the CRU of Cruz’s case is on hold pending a decision by Judge ShawnDya Simpson on whether his conviction will be tossed. A source familiar with the case was confident that it wouldn’t be overturned by the CRU.

Bonus claims the real killer is Eduardo Rodriguez — the man who fingered Cruz for the crime.

“There is an individual, a Hispanic male with a ponytail, who is caught at the scene firing a weapon. Two police officers see this and Scarcella comes in and the next thing you know Nelson Cruz is arrested four days later, three days after he turns 17 years old,” the lawyer said outside the courthouse.

Cruz has spent the last 21 years locked up. Friday was his 38th birthday.

Before the proceeding wrapped up for the day, Bonus asked Scarcella one final question.

“Do you stand by all the investigations you conducted?”

“110 percent,” the former cop replied.