“That’s when I saw they started becoming a little aggressive, more combative,” he said. “The video kind of shows what happened after that.”

As the men approached him, Officer Ali repeatedly told them to stay back. Officer Ali kicked one man to the ground who had gotten too close. That man got back up and started throwing punches. Officer Ali responded with his baton. Then the other men began to approach him.

A bystander helped separate Officer Ali from his assailants. But then a different man broke through the informal barricade and lunged at Officer Ali. The man tripped over his own leg, stumbled and fell onto the tracks.

Officer Ali remembered calling to have the power shut off to the third rail after the man fell onto the tracks. (Even as the men were attacking him, Officer Ali said, he was worried about their safety.)

But many other details caught on the video were lost to him in the fog of adrenaline.

“Looking at the video now from the outside, I’m like, ‘Whoa, that was a pretty ugly situation,’” he said.

The video was not the first time Officer Ali had gotten noticed online. He had achieved a small measure of attention after Customs and Border Protection detained him at Kennedy Airport in the early months of the Trump administration, even though he was a citizen, a New York police officer and a combat veteran who had spent two years in Kuwait.

Officer Ali credited that military training with helping him maintain his cool when the group of men were coming at him. He said he never even considered drawing his gun, because he didn’t think the situation called for it.