He sat toward the front of the bus, facing forward, immersed in a cellphone conversation, unaware that his life was about to end.

Angel Rojas was on a break between his two jobs on Thursday evening, riding the B15 through northern Brooklyn as he often did, taking time to stop at home to hug his children and grab a quick bite. When three young adults stepped aboard the bus, he most likely thought nothing of it.

Several rows back, the police say, a 14-year-old boy, a member of a street gang called the Stack Money Goons, had a visceral reaction. At least one of the three young adults belonged to a warring crew; there was a shared flash of recognition, and then, the police say, the 14-year-old pulled out a .357 revolver and fired one shot inside the bus.

The bullet missed the intended target but struck Mr. Rojas in the back of the head. Mr. Rojas had no time to react; there were few if any words exchanged, and police officials said a video of the encounter showed Mr. Rojas’s head simply slumping forward after sustaining the mortal wound.