Authorities are investigating whether an undercover police officer present at a motorcycle rally witnessed a violent confrontation between an SUV driver and a swarm of bikers and didn’t immediately report it, a law enforcement official said Saturday.

The officer came forward several days after the Sept. 29 rally to say he was present, according to the official, who spoke on condition of anonymity. The officer has an attorney, and internal affairs detectives are trying to determine whether he witnessed the assault on the SUV driver, the official said.

New York Police Department spokesman John McCarthy said a detective had been stripped of his gun and badge pending the outcome of an internal affairs investigation.

McCarthy said internal affairs was investigating the case and looking into whether any off-duty officers may have been present.

Undercover officers are required to immediately report being a witness to a crime. Uniformed officers are required to take police action if they see a crime occurring, but the rules are murkier for undercover officers who face blowing their cover, confusing civilians who don’t realize the undercover is really a cop and ruining yearslong investigations.

For example, Gescard Isnora, an undercover officer involved in the fatal police shooting of an unarmed man after his bachelor party in 2006, stepped out of his role and fired a shot as officers opened fire on Sean Bell and his friends. Isnora was fired and lost his pension after a departmental trial ruling that he should not have shot his weapon while undercover.

Last weekend, dozens of bikers stopped the Range Rover SUV on a highway, attacked the vehicle, then chased the driver and pulled him from the car after he plowed over a motorcyclist while trying to escape, police said. The driver, Alexian Lien, needed stiches after being pummeled by the bikers.

The motorcyclist who was crushed by the SUV, Edwin Mieses Jr., of Lawrence, Mass., suffered a broken spine and two broken legs and may never walk again, his family said.

Some of the encounter was captured on a camera mounted on the helmet of one of the bikers and was posted online. Investigators have been interviewing dozens of bikers and witnesses, but it still remains unclear how many people attacked Lien. On Saturday, police said two other motorcyclists were taken into custody and released a photograph of another man they say they want to question in connection with the attack.

Robert Sims, 35, of Brooklyn, was arrested on charges of gang assault and weapons possession. Police said he took part in the attack on Lien. There was no listed telephone number for Sims at the address where police said he lived.

He is the third person to face formal charges in connection with the attack, though the case against one of those motorcyclists was subsequently dismissed when prosecutors said they needed more time to investigate.

Police also detained another Brooklyn man Friday who they believed had participated in the attack. As of Saturday, formal charges had not been filed, authorities said.

Lien has not been charged. His wife said in a statement this week they feared for their lives as they drove off.

Mieses’ family held a news conference Friday with their lawyer in which they said that he wasn’t doing anything wrong when he was struck by Lien’s SUV. They acknowledged that Mieses had stopped his bike in front of the family’s vehicle but said he was trying to get the other riders to leave the family alone when he was hit.