An undercover cop on trial in the biker gang assault of a Manhattan dad squirmed on the stand as prosecutors challenged his claim that he did nothing to help the victim because he feared for his own safety.

“At the time you saw this man on the ground being beaten you did not intervene to help him, correct?” asked Assistant District Attorney Joshua Steinglass.

“Right. I looked over, I didn’t know who was in the car. I felt unsafe,” answered Wojciech Braszczok as he nervously fidgeted in his seat at the non-jury trial in Manhattan Supreme Court.

“I was afraid of who was inside the vehicle.”

Braszczok, 34, conceded he knew victim Alexian Lien’s wife was in the car.

“But I didn’t know who was in the back,” he claimed. “I didn’t see who was inside the car. I didn’t know.”

Lien’s infant daughter was in the backseat covered in shattered glass.

“You knocked out the back window,” the prosecutor shot back. “You had a pretty good view if you bothered to look.”

The tragic confrontation began earlier that afternoon when Lien was driving on the West Side Highway on Sept. 29, 2013.

He had an altercation with the rowdy gang of bikers, and they surrounded his SUV.

In a desperate bid to escape, the panicked father ran over and seriously injured one of them.

A swarm of bikers pursued the SUV to West 178th Street where the detective was caught on video shattering the rear window of Lien’s Range Rover with a gloved fist.

Then he’s seen doing nothing as his fellow bikers yank the Tribeca dad from his car and beat him until he’s unconscious in a pool of his own blood.

Braszczok told Justice Maxwell Wiley he’d only pursued Lien to detain him because he believed he’d killed a biker. But when the attack began, it was unsafe to intervene.

“Isn’t it true, Detective Braszczok, the real reason you didn’t stop the attack was because you were part of it?” demanded Steinglass.

“Absolutely not,” replied the detective.

The prosecutor asked Braszczok whether he believed he was guilty.

“Absolutely not,” he answered firmly. “In my heart and in my mind, I believe I did not commit any crime.”

Closings in the trial are expected Friday.