Updated

A medic testifying in the trial of Navy SEAL Edward Gallagher – who is accused of killing an injured ISIS prisoner of war in Iraq – shocked trial observers when he testified Thursday that he, not Gallagher, was responsible for the Islamic militant's death.

Special Operator 1st Class Corey Scott, a SEAL Team Seven medic, revealed during cross-examination in the courtroom at Naval Base San Diego that he killed the fighter by asphyxiation. Scott testified that he saw Gallagher stab the fighter, but then he himself held his thumb over a breathing tube that had been inserted into the militant's mouth.

“Did Chief Gallagher kill this terrorist?” Gallagher's attorney Timothy Parlatore then asked Scott.

"No," Scott replied.

COURT-MARTIAL BEGINS FOR NAVY SEAL ACCUSED OF WAR CRIMES 

The court recessed briefly after the stunning testimony from Scott, a prosecution witness who had been granted immunity. Fox News Correspondent Jonathan Hunt said he was in the hallway and spotted Gallagher and his wife Andrea hugging and laughing together, appearing to be relieved -- even celebratory -- after hearing what Scott had said.

“Why did you kill him?” Parlatore asked Scott during one point of the cross-examination.

“Because I knew he was going to die anyway,” Scott answered. “I wanted to save him from what was going to happen next to him.”

Gallagher, 40, previously pleaded not guilty to premeditated murder and aggravated assault charges stemming from the alleged killing and other alleged instances of firing sniper rounds at civilians in Iraq in 2017.

Throughout his 19 years of service, Gallagher earned the Bronze Star with V for Valor twice, a Meritorious Unit commendation, and a trio of Navy and Marine Corps Achievement medals, among other recognitions and decorations. (Courtesy Sean Gallagher)

Scott also told the defense counsel that during his time serving overseas, he had witnessed the Iraqi Emergency Response Division “torture, rape and murder prisoners.”

“Is this why you asphyxiated him?” Parlatore asked. “Yes,” Scott replied.

PROSECUTOR, IN OPENING STATEMENT, SAYS GALLAGHER WAS 'READY TO KILL

In other courtroom testimony that seemed straight out of a Hollywood movie, the Navy prosecutor opposite Parlatore raised his voice at Scott, charging that only now he was offering this testimony because he had immunity and he wanted to keep Gallagher out of jail. He accused Scott of never mentioning his role in the death during prosecution interviews that took place ahead of the trial.

“You never said that you covered the tube, did you?” asked Lt. Brian John, the prosecutor.

“You said he maintained vital signs until he stopped breathing,” he continued, reading off an interview transcript, accusing Scott of changing his story “only now, after you’ve been granted testimonial immunity.”

“You can lie about the fact that you killed the ISIS prisoner because you don’t want Chief Gallagher to go to jail,” Lt. John continued.

“I don’t want him to go to jail,” Scott shot back.

Edward Gallagher was hard on his men, multiple people close to him say. His brother, Sean, says there were a "few malcontents of guys" alongside Edward overseas "that didn’t like being reprimanded for not wanting to engage in combat." (Courtesy Sean Gallagher)

NAVY SEAL, IN GALLAGHER TRIAL, SAYS 'I SAW HIM STAB THE PRISONER ON THE SIDE OF THE NECK'

The courtroom drama continued to unfold as Parlatore -- a tall, imposing Navy veteran -- stood facing the navy prosecutor seated inches from him, accusing prosecutors of stopping short of ever asking Scott what the cause of death was. The reason, Parlatore charged, was because they had one goal: the prosecution of Gallagher.

Gallagher was undergoing a medical screening at Camp Pendleton and was in the process of transitioning to a non-combat advisory role for the Navy SEALs when he was taken into custody in September 2018, his brother Sean has said. Gallagher had planned to retire in the spring.

Throughout his 19 years of service, Gallagher earned the Bronze Star with V for Valor twice, a Meritorious Unit commendation and a trio of Navy and Marine Corps Achievement medals, among other recognitions and decorations.

He fought in Iraq and Afghanistan several times, reaching the status of what Sean Gallagher described as a “modern-day war hero.”

CLICK HERE TO GET THE FOX NEWS APP

It was during Gallagher’s final combat deployment, in 2017, that he was alleged to have committed war crimes. The Naval Criminal Investigative Service launched an investigation into Gallagher in April 2018.

Investigators previously have alleged that, while a teen ISIS fighter was receiving medical treatment from SEAL medics, Gallagher walked up and stabbed him in his neck and side with a knife, killing the terrorist. Then, they said, he posed for photographs with the fighter’s body, holding his head in one hand and his blade in the other.

Fox News' Jonathan Hunt contributed to this report.