Navy SEAL Eddie Gallagher was released from pre-trial confinement late Thursday after a contentious pre-trial hearing in which Navy prosecutors’ alleged misconduct came under serious scrutiny.

BREAKING!!!! Military Judge, Captain Rugh just released U.S. Navy SOC Chief Eddie Gallagher from pretrial confinement. @timparlatore #MarcMuksaey outstanding work!!! — Bernard B. Kerik (@BernardKerik) May 31, 2019

Gallagher’s release comes just a few hours after he celebrated his birthday with family in confinement.

Just a few hours after celebrating his 40th birthday with friends and family in confinement, Navy SEAL Chief Eddie Gallagher has been released from pre-trial confinement.#thankGod #freeEddie pic.twitter.com/AhkCHKzAFk — Gregg Phillips (@JumpVote) May 31, 2019

Breaking: Navy SEAL Chief Eddie Gallagher has been released from pretrial restraint by order of Navy Judge Capt. Aaron Rugh. His motions hearing is continued to Friday. — Andrew Dyer (@SDUTdyer) May 31, 2019

Outside the courthouse with the Gallaghers and their legal team, Marc Mukasey, left, and Tim Parlatore, right. pic.twitter.com/xRdGRmqWyk — Andrew Dyer (@SDUTdyer) May 31, 2019

The defense team for Navy SEAL Eddie Gallagher has withdrawn its motion to recuse the judge, Navy Capt. Aaron Rugh. Witness testimony continues as investigators answer questions about the email tracking tool sent to attorneys and media. — Andrew Dyer (@SDUTdyer) May 30, 2019

Photo of Navy SEAL Eddie Gallagher after being released from pre-trial confinement: pic.twitter.com/CpgXzQN7Mk — Kristina Wong 🇺🇸 (@kristina_wong) May 31, 2019

Sources familiar with the matter tell Breitbart News that the defense team for Gallagher, who is charged with war crimes in the death of an ISIS fighter in Iraq, made a series of motions in Thursday’s hearing to push for charges to be dismissed against him due to prosecutorial misconduct. Among other things, sources familiar with the matter say, the prosecution administered a lie detector test to Gallagher–which he passed–and did not disclose that to the court or to the defense. In addition, the prosecution spied on the defense and on the news media through email tracking programs.

The incident for which Gallagher is charged has come under question in recent weeks, as Breitbart News has reported extensively. A video of the actual incident was made available to members of Congress through Rep. Duncan Hunter (R-CA), who said the video proves that Gallagher was actually attempting to save the life of the ISIS fighter he is charged with killing, but rather rendering emergency field medical care to the fighter.

What happened in Mosul, Iraq, is that Gallagher’s unit was fighting with an ISIS cell holed up in a building for hours. After some time, the U.S. military used a hellfire missile to blow up the compound. The sole surviving ISIS fighter came out of the building, wounded, and was taken into custody by Iraqi forces. Several hours later, the ISIS fighter was transferred to the custody of the U.S. forces under Gallagher. Badly wounded, the ISIS fighter needed life-saving medical care. Gallagher, who is trained in emergency field medicine, per exculpatory photographs and video provided to members of Congress–and in the possession of prosecutors from day one–attempted an emergency procedure to try to save the man’s life so they could retrieve valuable intelligence from him. The ISIS fighter died.

Later, in the United States, Gallagher was charged with war crimes as a result of the incident. The Navy prosecutors bringing the case against him raided his home in the middle of the night, and Gallagher has been in federal custody for months since. At first, the facility he was kept in had substandard conditions, and news reports on the matter caught the attention of President Donald Trump, who ordered him moved to a safer facility.

The president’s lawyer Marc Mukasey, in a personal capacity, took up the case, and rumors circulated about whether President Trump might pardon Gallagher before the trial. Trump’s 2016 general election opponent, Democrat Hillary Rodham Clinton, bashed Trump for considering pardoning Gallagher:

But then news came out that the prosecution spied illicitly on the defense and on the news media, specifically the Navy Times. The trial was set to begin this week, but in the wake of these and other revelations, it has been repeatedly postponed. This week, pre-trial hearings were set starting on Wednesday. Those were delayed until Thursday, and now after a day full of embarrassing moments for the prosecution per sources presentm, the judge ordered Gallagher released. The pre-trial hearing with defense motions, including efforts to dismiss the case entirely, is set to resume on Friday, but now Gallagher is free from custody for the first time since this all began.

Andrea Gallagher, Eddie’s wife, has compared what the government did to her husband and her family to domestic terrorism. As Breitbart News reported for a Memorial Day weekend radio special:

“We’ve gone through eight deployments as a family, raising three children and really sacrificing my husband to the war on terror was our goal of achieving victory over what happened on 9/11,” Andrea Gallagher said in a Breitbart News radio exclusive hourlong special on her husband’s story that aired on Saturday and Sunday this weekend. “Over the years, we let him go time and time again. Never in a million years would I have foreseen that on his very last combat trip, which was to Mosul where he was previously awarded number one chief and number one platoon, he was tasked with clearing Mosul of ISIS, which he succeeded in, and then over a year later he would come back to a disgruntled group of individuals who, once they found out he was yet again being elevated for his twilight tour to a very coveted billet where he would be training every Navy SEAL on the West Coast, and once they found out they were going to be under him again, they set up a plot to take him down. Now, it never would have occurred to them, I don’t think, that it could have gone this far,” she said. Now, Andrea Gallagher says her family has been put through a “horrific nightmare” that she called “domestic terror” at the hands of NCIS Naval prosecutors who brought war crimes charges against her husband and for which he has been awaiting trial. “But our family has been entrapped in what I can only call a horrific nightmare, and it definitely has been encompassed by some domestic terror unleashed on our family by NCIS who picked up the case in April of 2018,” she said. “They raided our home, pulled out our kids at gunpoint into the streets in their underwear by June. So, less than 60 days on basically just rumors, lies, and hearsay is how they cobbled together this case. Ever since, we have suffered. My husband was taken out of a TBI clinic on 9/11. He was thrown in jail and he actually was in jail for seven and a half months before President Trump intervened in March.”

Rep. Hunter, in that same radio special, said that the reason this happened is political correctness infecting the military community.