MOSCOW — A courthouse became the scene of a deadly firefight on Tuesday afternoon, after five gang members awaiting trial tried to escape by seizing firearms from police officers, officials said.

Five members of the so-called G.T.A. gang — a name used by the Russian press in reference to the video game series “Grand Theft Auto” — were due for a hearing at the Moscow Regional Court when the melee broke out, according to Svetlana Petrenko, an official with the Investigative Committee, Russia’s equivalent of the F.B.I.

While riding in an elevator, one of the defendants suddenly began to choke a police officer, while the other defendants disarmed a second officer.

One of the two officers, who work for the Russian Interior Ministry, managed to call for help from the National Guard, an elite military unit.