Three defendants have been killed in a court in the Russian capital, Moscow, after they tried to take the arms from officers in an attempt to escape, officials say.
Five suspected gang members attacked two agents who were escorting them in a lift, the Investigative Committee said.
The group was handcuffed and it was not immediately clear how they managed to free themselves to attack the guards.
The two other suspects and three security officers were wounded.
The suspects were accused of being part of a group known as GTA Gang, named after the violent game series Grand Theft Auto.
The group of Central Asian nationals was suspected of killing 17 motorists in the Moscow area between 2012 and 2014. Cars were forced to stop on a main road and their drivers were killed for reasons as yet unknown; none of their possessions were stolen.
In the court, one of the suspects attacked and tried to strangle an agent, as others attempted to seize the officers' weapons, Russia's Investigative Committee said in a statement.
When the lift they were in opened on the third floor, Russian National Guard officers opened fire, killing three of the suspects as they tried to escape, the statement added.
The fact that the suspects were in any position to assault security agents inside the court and even attempt an armed escape is likely to raise questions, BBC Russian's Oleg Boldyrev in Moscow reports.
Suspects are usually brought into courtrooms handcuffed, with their arms crossed behind their backs, so this turn of events will probably be seen as bizarre, our correspondent adds.
The security officers injured include a National Guard member, who had a gunshot wound and was taken to hospital, and two police officers, who sustained various injuries, according to the Interior Ministry.
A lawyer who was at the building when the incident happened said that at least 20 shots were heard.
The members of the gang are accused of murder, banditry and other crimes, the Investigative Committee said. One of them had fought for so-called Islamic State in Syria before returning to Russia, Russian television reported.