San Diego, California -- Former Special Operations Chief Edward Gallagher was found not guilty on Tuesday on charges of killing an ISIS prisoner during a deployment in Iraq, though he was convicted on a lesser charge of wrongfully posing for an unofficial picture with a human casualty.

Gallagher was facing a court-martial on charges of murdering the ISIS prisoner in 2017. He will be sentenced on the lesser charge on Wednesday.

During his war crimes trial in a San Diego courtroom, prosecutors described Gallagher as a soldier who regularly shot at civilians and accused him of killing an ISIS prisoner in 2017 by stabbing him in the neck. Defense lawyers argued that no blood evidence was ever found on Gallagher’s belongings and that there were no videos of the alleged incidents. They further argued that the platoon was disgruntled with Gallagher, and fabricated the allegations against him.

In a shocking twist during the trial, Special Operator 1st Class Corey Scott, a Navy medic, testified he saw Gallagher stab the ISIS prisoner, but that it was Scott who suffocated the prisoner to death as an act of mercy.

Scott said he "wanted to save" the prisoner from the fate he would face if turned over to Iraqi authorities, adding "I knew he was going to die anyway," according to the New York Times.

Scott said the ISIS prisoner was stabilized after he and Gallagher treated him for wounds suffered in an airstrike, according to The Associated Press.

Gallagher allegedly stabbed the prisoner, and Scott testified that he would have lived through the stabbing had Scott not suffocated him, according to the AP. During Scott’s testimony, prosecutor Lt. Brian John reiterated several times that Scott had never said this before. John told the courtroom that Scott had immunity, and suggested he was claiming to have killed the ISIS prisoner to prevent Gallagher from going to prison. Scott responded, “Yes.”

“He’s got a wife and family,” Scott said. “I don’t think he should be spending his life in prison,” the AP reported.

The prosecution presented several text messages Gallagher sent his platoon, including one that allegedly read "I've got a cool story when I get back, I got him with my hunting knife."

"I thought everyone would be cool, next time I will do it so no one sees," Gallagher wrote to his platoon, once they allegedly turned on him. "Ready to kill the mother ------ who tells on me and I've got s--- on all of you to bring you down.”