John Parkinson, an Iraq War veteran who led a special operations unit in FBI’s Sacramento field office, first filed whistleblower complaints almost a decade ago when he became concerned with his coworkers’ behavior. He identified a colleague as having “a career-long pattern of soliciting prostitutes,” who used an FBI’s surveillance plane to travel to Reno to pay for sex. He alleged another colleague had a porn habit, even viewing explicit material at work. At one point, Parkinson removed furniture from an FBI office to keep it from getting soiled by the colleague, according to court documents.

After filing his complaint, Parkinson found himself the subject of what he says was a retaliatory investigation, and was eventually fired. He has been fighting that decision for the past four years through a Kafkaesque maze of courts and internal appeals.

On Monday, his attorneys filed a brief to the U.S. Federal Circuit Court of Appeals arguing for his right to raise a whistleblower retaliation defense.

Parkinson’s ordeal began eight years ago when he decided to lodge a whistleblower complaint about his colleagues’ alleged sexual misconduct. What followed was a little noticed whirlwind of professional reprisals, investigations, and legal battles.

After his complaint was filed, Parkinson’s boss removed him from his leadership position and gave him poor performance reviews, sending him to a different field office — actions he interpreted as retaliation. He reported those concerns in a letter to Rep. Chuck Grassley, R-Iowa, who forwarded it to the Department of Justice’s inspector general.

When the DOJ inspector general interviewed Parkinson in 2009, he thought it was about his whistleblower complaint; instead they questioned him about his own conduct, without mentioning he was the target of an investigation. The colleagues he reported for abuse had, in turn, claimed Parkinson misused funds on a construction project during his time in Sacramento, according to his attorney.

The FBI later claimed he obstructed the investigation into the alleged misuse of funds by communicating with witnesses, and that he “lacked candor” in his responses concerning those allegations.

In 2012, he was fired for those offenses.

FBI agents are typically required to make whistleblower complaints internally — a system Parkinson says he attempted to follow. But protections for FBI whistleblowers are notoriously slow and ineffective. As a military veteran, however, the defense argued and the court ultimately agreed, that Parkinson has special rights to raise his whistleblower defense outside the Department of Justice.

Thanks to the Civil Service Reform Act of 1978, military veterans who work for the FBI can challenge personnel decisions through the Merit System Protection Board — an independent panel.

After he was fired, Parkinson turned to the the Merit System Protection Board, and when the panel didn’t reverse the FBI’s firing decision, he took his case to the U.S. Court of Appeals for the Federal Circuit.

The court decided in March that Parkinson didn’t intentionally mislead investigators, but agreed the obstruction charge could stand. Because the remaining charges against him weren’t firing offenses, the court said the FBI was wrong when it terminated Parkinson. In fact, the court said the obstruction charge allowed for, at most, a 30-day suspension.

The court also agreed that if Parkinson were to appeal the obstruction charge, he should be allowed to raise a whistleblower defense.

After the federal appeals court ruled the FBI wrongly fired him, the Department of Justice fought back. Its attorneys filed legal briefs in June, writing that the court “erroneously held” that agents who served in the FBI “may raise whistleblower reprisal claims” outside internal channels because of the “sensitive” nature of such disclosures.

While Parkinson’s case was winding its way through appeals, Sen. Grassley proposed a bill in December 2015 that would give FBI whistleblowers the same protections as other government employees. “It’s no secret that FBI whistleblowers often face harsh consequences for simply trying to address failures or misconduct at work,” he said in a statement announcing the bill. That legislation hasn’t passed, however.

In the meantime, Parkinson’s case could set a precedent for military veterans in the FBI, while highlighting the general deficiencies of whistleblower protections for all FBI agents.

“The Civil Service Reform Act unambiguously grants FBI preference eligible veterans appeal rights …including affirmative defenses,” — and that includes whistleblower defenses, said Kathleen McClellan, one of Parkinson’s attorneys at Expose Facts, a nonprofit dedicated to providing legal protection to whistleblowers.

In the latest legal maneuver, the Department of Justice requested and received a special hearing to review the whistleblower defense. Depending on the court’s decision, the rights of military veterans in the FBI could be threatened.

“This is going to impact all future veteran FBI whistleblowers,” McLellan said in an interview with The Intercept.

Parkinson was unavailable for comment, according to his lawyer, as he is currently serving on active duty in the Marine Corps.

The FBI declined to comment on the case.