The FBI is quoted by USA Today as saying 25-year-old Siale Angilau, a member of the Tongan Crips gang, was shot several times in the chest after charging the witness in an aggressive, threatening manner.
The gun-shot Angilau died of his wounds later in hospital.
The witness, a Utah Tongan prison inmate, was testifying about the gang and how it operated.
Angilau was on trial for racketeering, robbery and assault, including shooting two US marshalls seven years ago.
The case was being heard before US District Judge Tena Campbell, who declared a mistrial before it was known Angilau had died in hospital.
The FBI assistant special agent-in-charge for the agency’s Utah office, Mark Dressen, told reporters outside the courthouse that the defendant “may have grabbed a pen or a pencil and charged the witness stand.
“The marshals did an exceptional job,” Dressen said. “They stopped the threat to the witness. The courtroom was fully secured at that time, and there’s no additional threats to the community.”
The trial had just begun on Monday when Angilau attacked the witness, according to an order signed by Judge Campbell.
“Angilau rushed and attacked a cooperating witness and was shot several times by law enforcement in front of the court and the Jury,” the judge wrote.
After the shooting, a group of marshals continued to hold the injured Angilau at gunpoint near the jury box.
“The court has met with the jury and observed that most of the jury members are visibly shaken and upset by this episode,” the judge wrote, adding, “The court finds that this occurrence in the courtroom would so prejudice Mr Angilau as to deprive him of a fair trial. The court hereby declares a mistrial.”
Angilau had been in Utah state prison since September 2007 until being handed over to the US Marshals Service last week for the trial.
He was not restrained in the courtroom.
Angilau was one of 17 people named in a 29-count racketeering indictment filed in 2008 accusing gang members of conspiracy, assault, robbery and weapons offenses.
Along with a string of robberies and assaults of local store clerks, the 6-foot-3, 260-pound Angilau was the last defendant in the case to stand trial, US attorney’s office spokeswoman Melodie Rydalch said.
A person inside the court told the Salt Lake Tribune that the marshal fired eight shots at the defendant after he jumped up from the defence table and charged the witness stand, trying to get at the witness.
The witness was 31-year-old Vaiola Mataele Tenifa. He is serving up to 30 years at the Utah State Prison on 2001 convictions for robbery and aggravated assault. The Angilau case was the last in a series of Tongan Crip-related trials that have been going on since 2007.
In 2011, a jury convicted six members of the gang for robbery, assault and use of firearms during crimes of violence committed in support of an ongoing criminal organization. Five others agreed to plea deals, and two were acquitted.
Some jurors at the time feared retaliation from gang members and wanted assurances from the judge that they would be safe.