San Diego -- Attorneys for a decorated Navy SEAL facing a murder trial in the death of an Islamic State of Iraq and Syria (ISIS) prisoner will try again Friday to have the case dismissed, after their client was unexpectedly freed from custody.

A military judge released Special Operations Chief Edward Gallagher from custody Thursday, drawing gasps in a San Diego courtroom.

The judge, Capt. Aaron Rugh, said releasing the platoon leader was a remedy for prosecutors interfering with his Sixth Amendment right to counsel.

Get Breaking News Delivered to Your Inbox

Gallagher's lawyers have condemned the prosecution for launching an unusual effort to find the source of news leaks in the politically charged case by embedding tracking code in emails sent to defense attorneys and a Navy Times journalist.

Defense attorney Tim Parlatore had 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.

Gallagher's wife, Andrea, who has led a campaign to free her husband, put her hands to her face and burst into tears.

Navy Special Operations Chief Edward Gallagher hugs his wife, Andrea Gallagher, after leaving a military courtroom on Naval Base San Diego on May 30, 2019; the decorated Navy SEAL is facing a murder trial in the death of an ISIS prisoner was freed from custody after a military judge cited interference by prosecutors Julie Watson / AP

"I feel like it's a small victory on the way to the larger victory," Andrea Gallagher said outside court while her husband stood quietly by her side in his Navy whites.

"We have been utterly terrorized by this entire farce of a case," Andrea Gallagher said.

He didn't comment, on the advice of his attorneys.

A spokesman for the Navy prosecutors also wouldn't comment on Gallagher's freedom or developments at the hearing, which continues Friday.

Gallagher has pleaded not guilty to murder in the death of an injured teenage militant in Iraq in 2017 and attempted murder for allegedly picking off civilians from a sniper's perch.

His platoon supervisor, Lt. Jacob Portier, is fighting charges of conduct unbecoming an officer for allegedly conducting Gallagher's re-enlistment ceremony next to the militant's corpse.

Efforts to get the case thrown out come as President Trump considers pardoning several service members accused of war crimes, including Gallagher, who faces trial June 10.

One of Gallagher's civilian defense attorneys, Marc Mukasey, is also a personal lawyer for the president, the Reuters news service notes.

Gallagher could face life in prison if he's convicted of all the charges, including murder, attempted

murder and obstructing justice, Reuters points out.

Gallagher says fellow SEALS testifying against him -- several after being granted immunity -- are disgruntled subordinates who made up allegations in an effort to get him stripped of his command, Reuters adds.

Evidence at the hearing showed prosecutors enlisted a Naval Criminal Investigative Service intelligence specialist to conduct criminal background checks on three civilian lawyers, including Parlatore, and a journalist with the Navy Times who has broken several stories based on leaked documents.

On Thursday, Rugh said investigators told him privately that they planned to embed code in what he believed to be a court document to help them find the source of leaks but the judge said he didn't have the power to authorize it and wasn't told they planned to target emails sent to the defense lawyers or a journalist.

The lead prosecutor downplayed the move at a related hearing earlier in the day. Cmdr. Christopher Czaplak said the code embedded in the email recorded nothing more than where and when messages were opened by recipients.

Czaplak said the tracking ended May 10 after he was confronted by defense lawyers who discovered the code in an unusual logo of an American flag with a bald eagle perched on the scales of justice beneath Czaplak's signature.

On Thursday, Czaplak said the code was similar to what marketers use to see when an email is opened and on what device.

"It's still a web bug and it's still unethical," countered defense lawyer Jeremiah J. Sullivan III, who represents Portier.

The judge in Portier's case, Capt. Jonathan Stephens, said from what he had seen the tracking effort wasn't able to view the contents of any emails.

Several experts testified that the code couldn't generally be used to identify a specific person or capture content.