A prosecution witness testifying at the court-martial of a decorated Navy SEAL accused of murdering a teenage Islamic State prisoner in 2017 dropped a bombshell in court on Thursday: He is responsible for the killing.

The revelation seemed to stun the courtroom and led the prosecutor to accuse his own witness of lying.

During the hearing, Navy SEAL Corey Scott admitted on the stand that he saw the defendant, Special Operations Chief Edward Gallagher, stab an injured fighter in the neck, but that the stabbing did not kill the fighter.

When asked what happened next, Scott, who was granted immunity to testify, said he suffocated the fighter until he died.

Gallagher is being court-martialed in the killing of the fighter in Iraq in 2017 and also on charges of attempted murder for allegedly shooting two civilians from a sniper's perch. He has pleaded not guilty.

Navy SEAL Special Operations Chief Edward Gallagher, charged with war crimes in Iraq, is shown in this undated photo provided May 24, 2019. Reuters

Scott said he saw Gallagher stab the unconscious fighter once behind the collar bone toward the back of the neck, but noted that the fighter still had a pulse and was alive.

“The stabbing I saw, yes," Scott said. "He would have survived."

Scott said he suffocated the fighter by putting his thumb over a breathing tube. As he was further questioned, Scott said he knew the fighter was going to die anyway and knew how he would be treated if he was turned over to the Iraqis.

According to NBC San Diego, Scott said he had witnessed Iraqi forces raping, torturing and killing prisoners.

Scott's proclamation caused a stir in the courtroom. Prosecutors said Scott was a liar and had never made his claim in the past. They said he only dropped the bombshell because he did not want Gallagher to go to jail.

The defense, however, said prosecutors never asked Scott how the fighter died and assumed it was because of the stabbing.

Scott said he made the revelation to keep an innocent man, with a wife and kids, from going to jail.

Gallagher was released from custody last month after a military judge cited interference by prosecutors. Lawyers for Gallagher previously tried to get the case dismissed because of prosecutorial misconduct.

The trial is expected to last up to three weeks, NBC San Diego reports.