Members of the FBI evidence response team enter the federal courthouse Monday in Salt Lake City. (Rick Bowmer/AP)

When Utah’s new federal courthouse opened last week, it came with security improvements that are becoming standard throughout the country: separate entrances and elevators for judges, defendants and the public; bullet-resistant glass and paneling; and vehicle barricades to keep car bombs at bay.

Even the design of the courtrooms, with plenty of sunlight and space, can help calm witnesses or defendants in high-stress cases, some judges believe.

But nothing can prevent every violent courtroom outburst. On Monday, a 5-foot-11-inch, 230-pound, pen-wielding defendant rushed a witness during his racketeering trial and was fatally shot by a U.S. marshal.

Siale Angilau, 25, was shot several times in front of stunned jurors, lawyers and courtroom watchers. He was one of 17 people named in a 2010 indictment accusing “Tongan Crips” gang members of assault, conspiracy, robbery and weapons offenses.

The unidentified witness, who was unhurt, had been testifying about gang initiation when Angilau charged him, said Perry Cardwell, who was in the courtroom. Cardwell was there to support his mother, Sandra Keyser, who was punched in the face during a holdup in 2002.

Shootings at federal courthouses are rare, though not unheard-of.

Last year, a former police officer who told friends that he was dying of cancer was killed by law enforcement officers after he sprayed bullets into a federal courthouse in West Virginia. In 2012, a man committed suicide at a federal courthouse in Alabama. In 2010, a man started shooting in the lobby of the Las Vegas federal courthouse, killing a court security officer and wounding a deputy U.S. marshal. The gunman was killed in a shootout.

Shootings inside courtrooms are even less common, largely because metal detectors ensure that armed spectators do not reach them.

But defendants usually are not shackled when they appear at trial, absent extraordinary circumstances. That makes their outbursts unpredictable. Courts have held that it is unfair to defendants for jurors to see them restrained. It’s unclear whether the U.S. Marshals Service, which provides security for judges and federal courthouses, had any unusual concerns about security in Angilau’s case.

Prosecutors say Angilau, also known by his street name “C-Down,” was a member of the Tongan Crips, a group of men of mostly Tongan descent aligned with a larger Crip culture in the Western United States. They have rivalries with “Blood” gangs and a gang of former members known as the “Tongan Crip Regulators,” court records show.

Angilau, the last defendant in the case to stand trial, was accused of robbing convenience stores and assaulting clerks in Salt Lake City on five occasions from 2002 to 2007. A clerk was shot in the final robbery. He also was accused of assaulting a federal officer with a weapon on Aug. 11, 2007.

Angilau’s trial was among the first at the new $185 million federal courthouse in downtown Salt Lake City, next door to the century-­old federal facility it replaced.

U.S. District Judge Tena Campbell declared a mistrial after the shooting, noting in her order that jurors were visibly upset. She issued a separate order extending the jurors’ term of service “until counseling is no longer needed.”

Angilau’s attorney, Michael Langford, declined to take questions as he left the courthouse.

— Associated Press

Johnson reported from Seattle. AP writers Annie Knox in Salt Lake City and Ken Ritter in Las Vegas contributed to this report.