An undercover detective who investigators said was off duty when he was recorded on video pounding on an SUV as a biker rally spiraled into violence was arrested late Tuesday.

Wojciech Braszczok surrendered to face riot and criminal mischief charges, New York Police Department spokesman John McCarthy said.

Braszczok was expected to make a court appearance today. There was no response to phone messages left with his attorney.

The attorney, Phil Karasyk, had said Monday that the detective, a 10-year veteran of the police force, had only witnessed other bikers attacking the vehicle.

But investigators discovered video evidence showing him punching an already damaged back window, then twice kicking the side of the SUV before leaving the scene, according to two people familiar with the case.

The people weren’t authorized to discuss the inquiry and spoke on the condition of anonymity.

The arrest added to the complexities of the Sept. 29 episode, which authorities say began with a reckless motorcycle group ride on a Manhattan highway and ended with one motorcyclist run over and the driver dragged from his SUV and beaten on a street.

Four bikers aside from Braszczok have been criminally charged; the latest was arraigned Tuesday on gang assault and other charges.

NYPD internal affairs investigators had initially been looking into the undercover detective’s conduct because he didn’t report until three days later that he had been at the rally. The expectation that police officers will act if they see crimes isn’t the same for undercover officers.

The encounter, captured partly on a helmet-mounted video that was posted online, began when about two dozen riders slowed down, swarming the Range Rover after it bumped a biker on the West Side Highway. Some riders dismounted and approached the SUV, and police said some bikers began damaging it.

The SUV’s driver, Alexian Lien, took off, running over motorcyclist Edwin “Jay” Mieses Jr., who’s from Lawrence, Mass. The impact broke Mieses’ legs and caused spinal injuries that may leave him paralyzed.

Lien’s wife has said he feared for their lives and the safety of their 2-year-old daughter and had no choice but to flee; Lien hasn’t been charged with any crime.

The bikers pursued the SUV, which exited the highway and got stuck in street traffic. One biker used his helmet to shatter the driver’s window, and others pulled Lien out and beat and kicked him, police and prosecutors said. Lien needed stitches.

The latest motorcyclist charged in the case, Craig Wright, punched Lien through the broken window and joined in stomping him on the street, Assistant District Attorney Samantha Turino said. A judge set Wright’s bail at $100,000.

Wright’s lawyer, Mitchell Elman, cautioned against any “rush to judgment” in the highly scrutinized case.

“Mr. Wright, obviously, has every right to fight these charges,” he said.

According to the undercover detective’s account, he saw motorcyclists attacking the SUV but didn’t see anyone harm Lien, Karasyk said Monday. The detective also didn’t see the SUV hit Mieses, the attorney said.

Carrying no badge or gun, and aware of cases in which officers had been suspended or dismissed for blowing their covers, “he had no other option, so he drove away,” said Karasyk, who works with the detectives’ union.