The police transit chief, Edward Delatorre, said there was just one crime for every million riders that pass through the system each day. It was the first recorded murder on the subway in just over six months.

Fights are common on the subway, but the video captured a rare instance of deadly violence.

When the train doors opened, passengers in the car where the men fought fled to other cars, prompting Mr. Bista, 47, to step out of the car in front of them. He started recording on his phone.

Mr. Bista said the victim and his assailants were fighting for control of the gun, and the men trying to break it up were asking a city transit worker to help. But Mr. Bista said the worker refused to step in. “He probably could get that gun in his hand and that person would not have lost his life,” he said.

Mr. Bista said he struggled to understand how the gunman escaped because police officers are usually camped out on the street below the station and they arrived quickly after the shooting.

The police said investigators were looking for two assailants, but the video appears to show a fourth man wearing a bandanna over his nose and mouth while tugging the victim. An older woman carrying a small rolling suitcase helps peel him from the fight and one of the men breaking it up pushes him against the train.

On the platform after the shooting, a man with a guitar slung over his shoulder appears alone and stunned, repeating aloud, “Oh my god!”

The train station was closed after the shooting, sending riders scrambling to adjust their plans before it reopened in the evening.