On March 18, 1997, Los Angeles Police Detective Frank Lyga thought the hard part of his day was over. The undercover narcotics surveillance detail he was working on had wrapped up for the day; he was headed back to the office. Then, stopped in his 1991 Buick Regal at the corner of Ventura Boulevard and Lankershim Boulevard, he was accosted by a black man in a green Jeep. Lyga pulled away, but the man gave chase. After the man pointed a pistol shouted a threat at Lyga — “I’ll cap you, motherf—ker!” — Lyga shot and killed him.

The white detective had survived a life-or-death confrontation. The problem: The man he killed, Kevin Gaines, was an LAPD officer.

The bizarre scenario — an apparent case of officer-on-officer road rage — would set off the investigation of a corrupt anti-gang unit that resulted in perhaps the scandal-ridden LAPD’s lowest moment. The fallout would lead to more than 100 lawsuits and cost Los Angeles $125 million. And, Lyga, though cleared of wrongdoing, would forever be labeled a racist.

And now, Lyga wants his day in court. The former detective, terminated from the LAPD just last year after making racially charged remarks in a discussion of Gaines’s death, is suing the city of Los Angeles for racial discrimination.

“The decision to terminate Plaintiff Frank Lyga was based not on evidence that he was a racist police officer, but on the perception by others that he is a racist police officer and the fact that if he is not terminated, it would give fodder to LAPD detractors who believe that LAPD harbors racist officers,” the lawsuit read, as the Los Angeles Times reported.

Lyga’s suit, filed last week in U.S. District Court, is just the latest twist in the tangled tale of the Rampart scandal that rattled the LAPD to its core two decades ago. After Lyga shot Gaines, the ensuing investigation revealed that Gaines, who had previously brandished his weapon behind the wheel, was connected to Suge Knight, a gang-affiliated hip-hop mogul who hired off-duty police officers as security.

As the probe widened, about 70 officers in the LAPD’s Rampart Division were investigated for misconduct. Rampart officers shot and framed civilians, committed perjury, stole drugs, robbed banks and generally behaved as badly as the gangs they were tasked to destroy. They even inspired a film — “Rampart” (2011), starring Woody Harrelson — and a lauded TV show, “The Shield.”

Lyga started it all.

“Lyga became the central figure in an episode that exposed deep ruptures within the L.A.P.D., and within the city it polices — dynamics that would, in large measure, define and propel the developing Rampart scandal,” the New Yorker wrote in 2001.

Yet though he may have been, in some ways, an innocent bystander, Lyga became the target of a $25 million lawsuit filed by star lawyer Johnnie Cochran on behalf of Gaines family. The lawsuit called him “an aggressive and dangerous police officer.” The city settled the suit for $250,000, infuriating Lyga. Though his decision to shoot Gaines had been deemed justified, he was denied his day in court.

“Despite the conclusions,” Lyga’s lawsuit read, “… Lyga was accused predominately by certain members of the African American community of being a racist and intentionally targeting Kevin Gaines because he was African American.”

Yet, as Lyga explained in his complaint, he soldiered on under the burden that had been thrust upon him.

“He continued to have an illustrious career as an expert in his field,” his suit read. “Lyga planned to continue working as a narcotics detective until he was no longer physically fit to do so.”

Then, in 2013, Lyga found himself conducting a training seminar on search warrants. After the seminar ended, students had questions about the Gaines shooting. And, though he was describing events that had happened during the Clinton administration, Lyga let loose like he had shot Gaines yesterday as an officer surreptitiously recorded his comments.

“I said, ‘No, I regret [Gaines] was alone in the truck at the time,'” Lyga said. “I could have killed a whole truckload of them and I would have been happy doing it.”

The notion that Lyga’s use of the word “them” had racial overtones was only bolstered by his other aggressive comments at the seminar. As the Los Angeles Times put it: “Lyga delivered an expletive-laden rant, calling a prominent black civil rights attorney an ‘Ewok,’ saying a female LAPD captain had been ‘swapped around a bunch of times’ and describing a lieutenant as a ‘moron.'” He also described the captain as a “very cute little Hispanic lady who couldn’t find her ass with both of her hands.”

But even as he spewed this hate, Lyga bemoaned his fate.

The “department just screwed me,” Lyga said, as described in his lawsuit. “I’m done. The city just — I’m labeled a racist killer.”

Though his career had thrived long after he killed a black fellow officer, Lyga was now ousted not for shooting a man, but for talking about the shooting inappropriately.

“You stated in your testimony that you have been fighting the negative image of being a racist cop killer, but then you, intentionally or not, confirmed this image during this speech,” a disciplinary panel concluded last year. It added: “In listening to your speech, it did not appear to be one of a wounded warrior, but one from an arrogant individual who was proud of his defiance, almost bragging about his conduct and disrespect for this department.”

One road to redemption remains: a civil action. Lyga wants $300,000 — and his job back.

As Joseph Avrahamy, one of Lyga’s lawyers, told the L.A. Times: “He’s hoping that through this lawsuit, the truth will finally come out that he’s not a racist.”

A spokesman for the LAPD declined to comment on the lawsuit, the LA Times reported. On the advice of its attorneys, the department does not discuss pending litigation and California law prohibited the spokesman from speaking about disciplinary matters, the Times also reported.