Special Warfare Operator 1st Class Corey Scott — the SEAL who dropped a legal bombshell on two ongoing war crimes cases by confessing on the stand to asphyxiating an Islamic State prisoner of war — likely won’t face any punishment for the death, according to a copy of his immunity deal shared with Navy Times.

In a dramatic moment during his Thursday testimony, Scott told a packed courtroom at Naval Base San Diego that the man on trial for premeditated murder, Special Warfare Operator Chief Edward “Eddie” Gallagher, the enlisted boss of Alpha Platoon, SEAL Team 7 during a deployment to Iraq two years ago, might’ve stabbed the detainee but he didn’t kill him.

To prevent Iraqi security forces from torturing the boy to death, Scott said, he blocked the seriously wounded teenager’s breathing tube and let him die. He was the killer, not Gallagher.

“I knew he was going to die anyway, and I wanted to save him from waking up to whatever would happen to him,” Scott said in his sworn testimony.

That sparked an angry retort from Navy prosecutor Lt. Brian John, who questioned why Scott didn’t tell investigators about it when they initially interviewed him.

He suggested that Scott might be lying to protect Gallagher, although Scott denied that.

But it appears unlikely either military or federal prosecutors can get Scott for murder. And the reason for that goes back to the legal efforts prosecutors themselves made to force him to testify as a star witness in Gallagher’s court-martial trial.

Legal bombshell explodes on SEAL war crimes trial SEAL medic says that Special Warfare Operator Chief Edward “Eddie” Gallagher didn't kill an Islamic State prisoner of war. He did.

× Fear of missing out? Sign up for the Navy Times Daily News Roundup to receive the top Navy stories every afternoon. Thanks for signing up. By giving us your email, you are opting in to the Navy Times Daily News Roundup.

A medic on May 3, 2017, Scott was one of the SEALs who treated the wounded Islamic State fighter when Iraqi security forces brought him to their compound near Mosul.

Prosecutors were convinced that Gallagher stabbed the detainee to death and they knew that Scott was next to him that day, monitoring the boy’s vitals, so he became a very valuable witness, according to internal files provided to Navy Times.

But Scott told prosecutors and Naval Criminal Investigative Service agents that he didn’t want to participate in the trial and later threatened to remain silent during a Feb. 11 reinterview session with them, a policy he vowed to continue on the stand to protect his Fifth Amendment right against self-incrimination.

So Navy Region Southwest and the U.S. Department of Justice granted him testimonial immunity to hurdle his Fifth Amendment protections and force him to talk to investigators and later testify in court.

Testimonial immunity safeguards a witness from his or her words being used later in a prosecution, but it doesn’t shield someone from what other witnesses say or other evidence uncovered by investigators.

Although his Texas-based attorney Brian Ferguson ― an Air Force Reserve major who took Scott’s case free of charge — continued to push for transactional immunity, which would have extended Scott’s protection from prosecution to any evidence against his client, Navy and Department of Justice officials balked at granting it.

But in a Feb. 5 message to two civilian attorneys representing witnesses in the Gallagher case, Navy Region Southwest Staff Judge Advocate Capt. Donald C. King announced that the military prosecution team “received assurances that the Justice Department has no intention to pursue any such prosecution against your clients.”

Beyond his own words, it’s unclear if any new evidence could even be turned up to prosecute Scott.

As Scott indicated in his testimony, he’s the only person who really can say how the detainee died because he was the only SEAL present for his last breath.

Even Gallagher had left the area and NCIS agents never found the dead detainee’s body to perform an autopsy.

Navy SEALs and Iraqi troops look at a young Islamic State fighter prosecutors say was murdered by Special Warfare Operator Chief Edward “Eddie” Gallagher. He says he was framed. (photo provided)

And Scott also likely will escape administrative sanctions.

That’s because, before the trial, Ferguson sought assurances from Scott’s SEAL commanders that they wouldn’t reprise against him for anything he said during the proceedings.

In a series of letters to Scott and other Ferguson clients who might be called by prosecutors or defense attorneys, Naval Special Warfare Group 1 commodore Capt. Matthew D. Rosenbloom took those sanctions off the table.

Rosenbloom insisted he was “not contemplating any judicial or administrative action against you based on the investigation” of Chief Gallagher, according to the letters.

He also refused to "use any statement you have made or will make in the course of the investigation or trial” of Gallagher “against you in any administrative proceeding that is within my cognizance, except for perjury, giving a false statement, failing to comply with an order to be deposed” or otherwise failing to testify.

Rosenbloom added that his powers of administrative oversight includes Captain’s Mast, a Trident Removal Board or an Administrative Separation Board.

In an early Monday email to Navy Times, Naval Special Warfare spokeswoman Tamara Lawrence indicated that Scott’s deal with Rosenbloom will be honored.

“The immunity letter speaks for itself," she wrote. "SO1 Scott’s immediate Commander granted him administrative immunity in exchange for a promise of truthful testimony. I don’t have any further comment on it.”

Ferguson declined comment.