Prosecutors unexpectedly dropped all charges Friday against 26-year San Francisco police veteran Joel Babbs, a whistleblower who had been facing misdemeanor counts of vehicle registration fraud and filing a false police report.

“I believe in the court system,” Babbs said outside San Francisco Superior Court after Superior Court Judge Sharon Riordan granted prosecutors’ motion to dismiss the case in the interests of justice.

Babbs has said repeatedly that the charges were part of a campaign of retaliation that began when he reported accusations of misconduct based on videos he shot of roll call at the department’s Muni division.

Babbs’ attorney, Murlene Randle, said the decision came after she met with District Attorney George Gascon and presented evidence that the vehicle registration tag fraud charge was not substantiated and the false police report charge was not justifiable.

Babbs said his legal ordeal started after he lodged misconduct allegations against his superiors in late 2016.

“They ruined 26 years of my career right here, all because I told the truth, I blew the whistle,” he said, adding that one secret tape shows a police commander boasting about using force against a woman in the Bayview.

“If you ever see her, she’s missing a tooth from me,” the supervisor says on the recording reviewed by NBC Bay Area. “I went to hand cuff her and she grabbed my hand, so I f—ing grabbed finger and snapped it.”

The city last year officially ruled that Babbs had been targeted for retaliation based on his complaint.

But the dismissal of the charges was bittersweet for Babbs, who says he is stripped of his star and gun as he fights internal affairs charges.

“It’s short term vindication, what I mean is, I’m still going through a process of retaliation. Each and every day I come to the police department, more charges are being piled on me.”

The Police Department issued a statement about Friday’s dismissal, saying: “We respect the District Attorney’s decision. We are unable to comment further about this case, which is a personnel matter.”