SAN DIEGO (AP) — A military judge on Friday refused to dismiss the murder case of a decorated Navy SEAL, but found the prosecution's meddling in defense lawyer emails troubling enough to reduce the maximum penalty he faces.

The judge, Capt. Aaron Rugh, said the email tracking effort harmed the public's view of the military justice system and cast doubt on its ability to give Special Operations Chief Edward Gallagher a fair trial.

The ruling in one of the Navy's most prominent war crimes cases came just days the judge removed the lead prosecutor as the defense sought dismissal of the case for alleged misconduct in what they characterized as "spying."

Rugh found the intrusion "placed an intolerable strain on the public's perception of the military justice system."

Rugh said the maximum penalty he would impose if Gallagher is convicted of premeditated murder would be life imprisonment with the chance of parole. Gallagher had been facing life without parole.

He also said he would allow the defense to reject two more potential jurors without cause during jury selection.

Gallagher is scheduled to go to trial June 17 on murder and attempted murder charges.

On Monday, Rugh removed the lead prosecutor, Cmdr. Christopher Czaplak. He said it was not within his power to determine whether Czaplak engaged in misconduct, but the potential for a probe into his actions could present a conflict and required his removal.

It is extremely unusual for a military judge to remove a prosecutor only days before the start of a trial. The military justice system has won few war crime convictions and been criticized for being ineffective.

Last week, Rugh unexpectedly released Gallagher from custody as a remedy for interference by prosecutors in the middle of a hearing that also included accusations they withheld evidence that could help his defense.

Republicans in Congress have lobbied for Gallagher, saying he has been mistreated. President Donald Trump intervened to move Gallagher to less restrictive confinement in March and has considered dismissing the charges.

Gallagher pleaded not guilty to a murder charge in the death of an injured teenage militant in Iraq in 2017 and to attempted murder in the shooting of two civilians from a sniper's perch.

He blames disgruntled platoon mates for fabricating complaints about him because they didn't like his tough leadership.

Defense lawyers for Gallagher and his commanding officer, Lt. Jacob Portier, have said most of the court documents leaked to reporters have hurt their clients, so the sources are likely on the government side.

Portier has denied charges of conduct unbecoming an officer after being accused of conducting Gallagher's re-enlistment ceremony next to the militant's corpse.

Rugh indicated he was misled about the effort to embed code in emails sent to the defense team and a journalist to track where those messages were sent to find the source of leaks that have plagued the case.

He said he didn't have the authority to approve such a tactic and was led to believe Czaplak was working with federal prosecutors so his consent was not necessary.

Rugh said he learned Friday that the U.S. attorney's office in San Diego had not approved or coordinated the tracking, defense lawyer Tim Parlatore said.

Evidence at hearings last week showed an intelligence specialist from Naval Criminal Investigative Service conducted criminal background checks on three civilian lawyers and a Navy Times journalist who has broken several stories based on documents that are only to be shared among lawyers in the case.

Parlatore, who was among the lawyers investigated, accused prosecutors of a "rogue, relentless, and unlawful cyber campaign" that may have violated attorney-client privilege and hurt his client's ability to get a fair trial.

Czaplak downplayed the move, saying the code embedded in emails recorded nothing more than what marketers use to find out where and when messages were opened by recipients.

Another prosecutor, Lt. Scott McDonald, said no search warrant was necessary because they only gathered data, such as internet protocol addresses, and did not snoop on the content of emails.

"Even if there was some intrusion" in violation of attorney client-privilege, it didn't rise to the level to dismiss the case, McDonald said.

The government said the investigation did not find the source of leaks.

___

Melley reported from Los Angeles.