An undercover New York City police detective accused of being one of 11 motorcyclists who assaulted a driver in Upper Manhattan testified on Tuesday that he became frightened for his own safety when he saw the man being pummeled and fled instead of intervening to help him.

“I thought my safety was being threatened, and I made the decision to leave the scene,” the detective, Wojciech Braszczok, said as he took the stand in his own defense in State Supreme Court in Manhattan. “In my mind the situation was unstable.”

The detective said he was “appalled” when he saw that other motorcyclists had dragged Alexian Lien from his Range Rover and were hitting him with fists and helmets but, as an undercover officer on his day off, he did not have his badge or gun with him. “I didn’t think they would have believed me that I was a cop,” he said. “I wish I could have done more to help the driver.”

The detective denied he ever intended to take part in the attack on the driver. He said he had seen the Range Rover run over a motorcyclist a few minutes earlier on the Henry Hudson Parkway near 125th Street and, like scores of other motorcyclists, was trying to stop the driver from fleeing.