Monday when the defendant tried to attack a witness with a pen at the new federal courthouse in Salt Lake City.
Siale Angilau, 25, who reportedly belonged to Tongan Crip gang, was shot several times in the chest and died later at a hospital, the FBI said.
"During the trial this morning the defendant went after, engaged the witness stand, and when he engaged the witness at the witness stand, he was shot by the U.S. Marshals Service," said FBI spokesman Mark Dressen. "From what I understand, the defendant may have grabbed a pen or a pencil and charged the witness stand at that time."
Angilau was on trial on racketeering charges in the courtroom of U.S. District Court Judge Tena Campbell. Along with a string of robberies and assaults of local store clerks, the 6-foot-3, 260-pound Angilau also was accused of shooting two U.S. marshals in 2007 and brandishing a firearm.
A spectator told the Salt Lake Tribune that the marshal fired eight shots after Angilau jumped up from the defense table, charged the witness stand and tried to punch the witness, who was wearing a prison jump suit and testifying about the gang and how it worked.
The witness was 31-year-old Vaiola Mataele Tenifa, his attorney, Steven Killpack, told the newspaper.
Tenifa is serving up to 30 years at the Utah State Prison on 2001 convictions for robbery and aggravated assault.
The shooting prompted Campbell to declare a mistrial. She said in a brief order that U.S. marshals had continued to hold Angilau at gunpoint near the jury box while jurors were still in the courtroom.
"The court has met with the jury and and observed that most of the jury members are visibly shaken and upset by this episode,'' the judge wrote. "The court finds that this occurrence in the courtroom would so prejudice Mr. Angilau as to deprive him of a fair trial."
Angilau's lawyer, Michael Langford, was not immediately available for comment. His office said the lawyer was "a bit shaken up but okay.''
The federal courthouse, which opened last week with upgraded security, was placed on lockdown.
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 seven members of the gang for robbery, assault and use of firearms during crimes of violence committed in support of an ongoing criminal organization, the Deseret News reports.
The newspaper says some jurors at the time feared retaliation from gang members and wanted assurances from the judge that they would be safe. A note from a juror asking for such assurances nearly caused a mistrial in the case, the News reports.
Contributing: Donna Leinwand Leger; Associated Press