The trial of Navy SEAL chief Eddie Gallagher has reached its verdict. Gallagher was cleared of charges of murder and attempted murder and was found guilty of posing for photos with the dead body of a teenage ISIS captive. 

Special Operations Chief Edward "Eddie" Gallagher, 40, was acquitted of murder charges yesterday in a Naval courtroom in San Diego. 

He was found guilty on one charge - posing for photos with the body of the dead captive - but will not serve time because the sentence, four months, is less than the time he spent in pre-trial detention. 

Read More: Decorated Navy SEAL on trial for killing Islamic State prisoner

In a turn of events that stunned prosecutors, a witness for the prosecution who initially testified that he had seen Gallagher stab the teenage captive in their custody changed his testimony to say that he himself had killed the boy by blocking air to a tracheal tube in his neck. 

U.S. Navy SEAL Eddie Gallagher has been found not guilty of war crimes in the murder of an ISIS prisoner. @CBSDavidMartin explains the key arguments that may have swayed the jury in the case.

— CBS News (@CBSNews) July 2, 2019

The witness, Navy SEAL medic Corey Scott, had been granted immunity from prosecution in exchange for his testimony. He may now face perjury charges. 

Chief Gallagher, a decorated SEAL platoon leader who completed eight tours of duty, was accused last spring by his own subordinates of a number of crimes while deployed to Mosul, Iraq in 2017. They included stabbing to death an injured teenage ISIS captive, distributing photos of himself with the corpse via text message, shooting at unarmed civilians including an elderly man and a schoolgirl, and intimidating members of the SEAL team into not reporting him. 

Gallagher's subordinates first reported their concerns to the platoon commander, Lt. Jacob Portier, shortly after the alleged crimes took place in 2017. However, Lt. Portier did not act on the SEAL team's report for nearly one year, resulting in a lacj of physical evidence. Thus, the trial hinged on witness testimony and on Gallagher's text messages and photos. 

Read More: WATCH - Irish American Navy SEAL describes the unusual way bin Laden was identified

They included so-called "victory photos" he took with the boy's corpse, which he sent to comrades in the US with messages like "Good story behind this. Got him with my hunting knife" and "I've got a cool story for you when I get back. I've got my knife skills on." 

Throughout the two weeks of the trial, members of Gallagher's platoon testified that they had seen the chief stab the captive multiple times and attempt to conceal the evidence. However, when Scott was cross-examined by the defense, the Special Operator said that he himself had killed the boy. CNN reports that he described it as a "mercy killing" because he was worried the Iraquis would harm him. 

Navy Seal Eddie Gallagher says he wants to thank @realDonaldTrump for intervening in his case. A jury just found Chief Gallagher not guilty of murder #ABCNews #EddieGallagher

— Will Carr (@WillCarr) July 3, 2019

Outside the courtroom yesterday, Gallagher told reporters "I'm happy and I'm thankful. I thank God, my legal team and my wife."

According to the Daily Mail, his wife, Andrea, who ran a vigorous social media campaign proclaiming Gallagher's innocence and unfair treatment, said: 

"I was feeling like we're finally vindicated after being terrorized by the government that my husband fought for for 20 years.

"I think that this vindication, I hope, will be a lesson learned to everybody, that we need to uphold innocent until proven guilty [and] due process."

Navy SEAL Eddie Gallagher is found not guilty of murdering an ISIS terrorist by a military jury. | @ToddPiro

— Fox & Friends First (@FoxFriendsFirst) July 3, 2019

They drove away in a white Mustang convertible, joking that they had an evening of "tattoos and alcohol" ahead. 

Chief Gallagher's family claimed that he was wrongfully persecuted by "millennial" subordinates who resented his leadership. They maintained his innocence throughout the trial and worked closely with news outlets like the Navy Times in addition to some Republicans in Congress, who lobbied on behalf of Gallagher. 

Read More: Shannon Kent, Navy hero, killed in Syria by suicide bombing

President Trump, who had intervened to release Gallagher from his pre-trial detention, congratulated him and his family via Twitter: 

Congratulations to Navy Seal Eddie Gallagher, his wonderful wife Andrea, and his entire family. You have been through much together. Glad I could help!

— Donald J. Trump (@realDonaldTrump) July 3, 2019