A judge on Friday declined to throw out a war crimes case against a Navy SEAL but reduced his maximum potential sentence over murder charges after he said prosecutors secretly tracked the defendant's emails.

The military judge, Capt. Aaron Rugh, ruled that attorneys for Special Operations Chief Edward Gallagher were hampered by efforts from prosecutors to track emails sent between them and their client, according to The Associated Press.

ADVERTISEMENT

The secret tracking, Rugh declared, was so intrusive that it tarnished the Navy's image as supportive of fair trials and impeded Gallagher and his attorneys from successfully defending his case.

“It hampered the defense’s opportunity to prepare for trial as they became necessarily enmeshed in discovery and litigation related to the operation, thereby harming the accused’s right to competent counsel,” Rugh said, according to the AP.

It also "placed an intolerable strain on the public’s perception of the military justice system," the judge said.

Rugh added that he would reduce the maximum sentence Gallagher faces for the charges of murder and attempted murder for his actions toward two civilians in Iraq as well as a wounded Iraqi militant. The defense was also given the right to dismiss two potential jurors, according to the AP.

Gallagher has pleaded not guilty to the charges and maintains that reports of his behavior were made by those who disapproved of his leadership style.

His defense attorney released a statement earlier this week after the lead prosecutor on the case was removed because of the spying accusations.

“There’s no way he should be allowed to continue on this case,” Gallagher's attorney said of the prosecutor. “We’re still hopeful the entire case will be dismissed.”

President Trump Donald John TrumpBiden on Trump's refusal to commit to peaceful transfer of power: 'What country are we in?' Romney: 'Unthinkable and unacceptable' to not commit to peaceful transition of power Two Louisville police officers shot amid Breonna Taylor grand jury protests MORE stepped in to move Gallagher to "less restrictive confinement" in March as he awaited court proceedings. The president has also reportedly considered dismissing the charges.