A decorated Navy SEAL was found not guilty of murder and attempted murder Tuesday by a military jury in San Diego.

Navy SEAL Special Operations Chief Edward Gallagher, 40, was accused of fatally stabbing a young wounded fighter for the Islamic State militant group, posing for a picture with the corpse and shooting two civilians from a sniper's perch in Iraq in 2017.

Gallagher was found guilty on the charge involving the photo with the corpse.

Navy Special Operations Chief Edward Gallagher walks out of military court with his wife Andrea Gallagher during lunch recess on July 2, 2019 in San Diego, California. Gallagher, accused of several war crimes, was found not guilty of murdering a teenage ISIS militant. Sandy Huffaker / Getty Images

After the verdict was read, Gallagher, his wife and the whole defense team stood up and began hugging. Gallagher and his wife, Andrea, who was crying, touched foreheads and held each other’s faces.

Gallagher told reporters after the verdict was read: “I’m happy and I’m thankful. I thank God, and my legal team and my wife.”

His sentencing for wrongful posing for photos with a human casualty could happen as early as Wednesday.

"We have a sentencing to do, but the maximum sentence on what they’re about to sentence him on is much less than the time that they’ve already had him in the brig," defense attorney Tim Parlatore said after Tuesday's verdict. "So he is going home."

Parlatore called the case "an almost two-year nightmare" and said it was "a good day." Andrea Gallagher said, "we're finally vindicated after being terrorized by the government that my husband fought for for two decades in the war on terror."

The jury of five Marines and two sailors — one of whom is a SEAL — had to decide if the boy was stabbed to death, or died from wounds sustained during an airstrike with Gallagher being falsely accused by disgruntled subordinates. The jury began deliberations Monday in the court-martial at Naval Base San Diego.

Seven SEALs have testified during the trial over the past two weeks that Gallagher abruptly stabbed the teen prisoner on May 3, 2017, just after he and other medics treated the boy.

Two of them said they witnessed Gallagher, a 19-year-veteran, stab the teen. But one of them, Special Operator Corey Scott, who is also a medic, said he was the person who killed the boy when he plugged his breathing tube with his thumb in an act of mercy. The admission stunned the courtroom.

Most of the SEALs, including Scott, were granted immunity to protect them from being prosecuted for what they said on the stand.

An Iraqi general testified that Gallagher did not stab the boy, and Marine Staff Sgt. Giorgio Kirylo said that he didn't see any stab wounds on the young ISIS fighter when he moved the corpse to take a "cool guy trophy" photo with it.

On Monday in closing arguments for the prosecution, Navy Cmdr. Jeff Pietrzyk told the jury that while the detained Islamic fighter was not a sympathetic figure, he was under the control of the U.S. military, which meant he was no longer a lawful target.

Pietrzyk also said that text messages sent by Gallagher prove his guilt. One message said: "I've got a cool story for you when I get back. I've got my knife skills on." Another text stated: "Good story behind this. Got him with my hunting knife."

Pietrzyk then showed a photo of Gallagher holding up the dead prisoner's head by the hair. "The government's evidence in this case is Chief Gallagher's words, Chief Gallagher's pictures, Chief Gallagher's SEALs," Pietrzyk said, according to The Associated Press.

Gallagher's lawyers said the text was just an example of dark combat humor.

Parlatore said Monday that Scott's surprise testimony about blocking the airway tube happened because prosecutors never asked the right questions because they were so fixated on prosecuting Gallagher.

He said that there was no body, no forensics, no science and no case against Gallagher. He said much of what was communicated in texts was just bravado.

"This is case is not about murder, it's about mutiny," Parlatore said, telling jurors that the SEALs who testified against Gallagher lied because they didn't like his demanding leadership.

SEAL sniper Dalton Tolbert testified that he does not remember who started a group chat called "The Sewing Circle," but the purpose of it was to connect with others who were disturbed by what they saw while deployed with Gallagher, and decide how to handle it.

"I shot more warning shots to save civilians from Eddie than I ever did at ISIS. I see an issue with that," Tolbert wrote in one of the texts.

Gallagher was released from custody in May after the military judge cited interference by prosecutors.

After Scott's bombshell testimony, Andrea Gallagher said she always knew her husband was not guilty, and that "I just felt so relieved that at least one of these individuals had a, you know, conscience check."

Prosecutors said at the time that the credibility of a witness was for the jury to decide.

Andrea Gallagher said Tuesday that her husband's name has been tarnished by the prosecution and that “I think this whole thing is disgusting.”

“He is a righteous and noble individual and his name has been smeared and slandered and dragged through the mud," she said. "We need to afford the benefit of the doubt to our war heroes who we send over there to fight these evils."

“I felt that this is finally the moment that we've been waiting for, that the truth came out,” Andrea Gallagher said.