A panel of military judges has thrown out the conviction of a Marine Corps veteran who acknowledged urinating on Taliban corpses six years ago, saying it appears that the service’s top general at the time meddled in his case.

The Navy-Marine Corps Court of Criminal Appeals ruled this week the case of Staff Sgt. Joseph Chamblin must be set aside because of apparent unlawful command influence, which occurs when a senior military officer uses his or her position of authority to influence legal proceedings. The ruling cited the actions of now-retired Gen. James Amos, who was commandant of the Marine Corps from 2010 to 2014, and some of his senior staff members.

Chamblin had pleaded guilty to a several charges in connection with the incident, including dereliction of duty and violating a lawful general order. As part of a pretrial agreement in 2012, he was reduced one rank to sergeant and fined $500.

Navy Cmdr. Marcus Fulton, who filed the ruling on behalf of himself and two other judges, wrote that dismissing the case was a “drastic remedy” to what occurred but one that was necessary to “foster public confidence in the . . . fairness of our system of justice.” Fulton added that an outside observer looking at the situation would share observations made by some Marine Corps lawyers, who reviewed the case at the time and warned that it looked as if Amos and “lawyers who reported to him ‘severely and systematically interfered’ with this case.”

Amos did not respond to a request for comment.

Chamblin, who declined to comment Thursday, was in charge of a scout-sniper platoon in Afghanistan’s Helmand province in July 2011 when he and other Marines killed three Taliban fighters, recovered their bodies, and then urinated on them while posing for photographs and video. The video was first posted by TMZ in January 2012, prompting an international backlash. Numerous Obama administration officials – and Amos, a member of the Joint Chiefs of Staff – also expressed outrage.

Within days, Amos appointed then-Lt. Gen. Thomas Waldhauser to investigate the cases, giving him “sole and unfettered discretion” in how to handle the cases. Amos was required to stay away, the ruling notes.

Waldhauser, now a four-star general overseeing U.S. Africa Command, later told Amos that he had decided against sending any of the Marines to a general court-martial, the military’s most serious form of trial. Amos took umbrage, saying he wanted all of the Marines involved “crushed” and discharged from the service, Waldhauser acknowledged in a sworn statement.

“I responded, ‘No, I’m not going to do that,’ stating that I did not believe any of the cases warranted General Court-Martial,” Waldhauser wrote. Amos, Waldhauser’s statement said, then told him he could be removed from the case.

Eventually, that’s what happened. In a letter to Waldhauser explaining the move, Amos wrote, “I believe some of my comments during our recent conversation could be perceived as possibly interfering with your independent and unfettered discretion to take action in those cases.” Waldhauser was being removed, Amos added, “to protect the institutional integrity of the military justice process, and to avoid potential issues.”

But the Marine Corps failed to notify the accused Marines and their attorneys why Waldhauser was removed.

The appellate judges also found that a decision by the Marine Corps’ top lawyer at that time to remove another attorney on the case also constituted “some evidence” of unlawful command influence. The attorney who was removed had protested what he considered the “irregular classification of evidence.”

The ruling specifically blamed Amos for complicating the case.

“The highest-ranking officer in the Marine Corps told the [general overseeing the case] that the appellant and his co-accuseds should be ‘crushed.’ This is an unusually flagrant example” of unlawful command influence, Fulton wrote, calling it “highly corrosive” to the public’s trust in this legal proceeding.