A trial of a decorated US Navy SEAL charged with a wounded ISIL prisoner's murder - one of the Navy's most prominent war crimes cases - is set to begin at US Naval Base San Diego on Monday.
The court martial of Special Operations Chief Edward Gallagher, 39, is expected to last three weeks, beginning on Monday with the selection of between five and 15 active-duty Navy officers and enlisted personnel as jury members.
The pre-trial proceedings included the removal of the lead prosecutor for tracking the defence team's emails amid suggestions by President Donald Trump that he may pardon the defendant.
Gallagher has pleaded not guilty to premeditated murder in the killing of the wounded prisoner in his care by stabbing him in the neck, and attempted murder in the shootings of two unarmed civilians - a school girl and an elderly man - from a sniper's perch in Iraq's Mosul city in 2017 in separate incidents.
The defendant has said disgruntled platoon mates fabricated the allegations because they did not like his tough leadership.
Gallagher's lawyers asked the Navy judge to dismiss the case because they say investigators and prosecutors withheld evidence that could help the defence and violated his rights to a fair trial by embedding tracking software in emails sent to them.
The judge, Captain Aaron Rugh, earlier this month ruled the prosecution's effort to track defence emails to find a news leak cast doubt on Gallagher's ability to get a fair trial and violated his constitutional rights against illegal searches and the right to counsel by interfering with attorney-client privilege.
Rugh, however, refused to dismiss the case. Instead, he said he was taking steps to remedy the interference.
He released Gallagher from custody, removed the lead prosecutor and lessened the maximum penalty he faces if convicted of premeditated murder to life imprisonment with parole - instead of no parole.
The judge is also allowing the defence to reject two more potential jurors without cause than usual during jury selection.
Evidence at hearings last month showed an intelligence specialist from the Naval Criminal Investigative Service conducted criminal background checks on three of Gallagher's 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.
Prosecutors downplayed the effort, saying it only gathered data, such as internet protocol addresses, and did not snoop on the content of emails.
The government said the investigation did not find the source of leaks.
Gallagher's family maintains he cannot get a fair trial.
"The court's ruling, recognising a direct violation of Chief Gallagher's constitutional rights but not dismissing the case, sends a chilling message to every man and woman in uniform," his family said in a statement.
The prosecution also tracked emails of the lawyers of Gallagher's commanding officer, Lieutenant Jacob Portier, who faces charges of conduct unbecoming an officer after being accused of conducting Gallagher's re-enlistment ceremony next to the corpse of a fighter of the Islamic State of Iraq and the Levant (ISIL or ISIS) armed group.
The defence discovered a tracking code hidden in a suspicious logo of a US flag with a bald eagle perched on the scales of justice beneath the signature of lead prosecutor Commander Christopher Czaplak.
Rugh removed Czaplak from the case because he said the potential for an investigation into his actions could present a conflict.
He said it was not within his power to determine whether Czaplak engaged in misconduct.
The judge said the effort also harmed the public's perception of the military justice system, which has been criticised for being ineffective and has gained few war crime convictions.
Republicans in Congress have lobbied for Gallagher, claiming he was an innocent war hero being unfairly prosecuted.
Trump, who intervened to move Gallagher to less restrictive confinement in March, said last month he was considering a pardon for several US army members accused of war crimes.