A police officer on trial for recklessly disregarding his training and risk of death in an East New York public housing patrol that left an innocent man dead testified emotionally Monday but said officers could pull out their guns when feeing unsafe.

Recounting the moments before a single bullet from an unintended shot ricocheted down a stairwell into the chest of Akai Gurley, Officer Peter Liang said he had opened a door into a “pitch black” stairwell when he heard a “quick sound” that startled him. “The gun just went off,” he said.