Metro

Video captures off-duty cop in shootout with armed carjacker

He picked the wrong guy.

A would-be carjacker who whipped out a pistol was left in critical condition after he opened fire on an off-duty NYPD officer and the cop responded in kind, authorities and sources said.

The unidentified undercover cop had just left work and was driving at the corner of East 87th Street and Foster Avenue in Canarsie around 2 a.m. when Ahmad Nicholls, 28, accosted him, authorities charged.

Surveillance footage obtained by The Post allegedly shows the foiled thief strolling across the intersection and up to the cop’s white sedan.

The two appear to have words as Nicholls approaches the driver’s window — before the car slowly drives into the intersection in an apparent bid to evade the man.

The suspect whips out what appears to be a pistol and follows the car as the off-duty cop swerves along the crosswalk, video shows.

The attacker appears to try to open the car door, and that’s when the officer exits the ride.

A single flash of apparent gunfire flickers near Nicholls’ hand before the cop’s own muzzle flares several times and the man falls over in a heap.

“Our member of the service then pulled out his firearm, shooting several times at our perpetrator, striking him in the chest,” police said.

He was also hit in the arm, according to authorities.

Nicholls was allegedly carrying a pair of pistols and a knife, cops said.

One of the guns was wrapped in a rubber glove and had been shoved in his butt earlier in the night, according to sources.

It appears he shot at the cop with the other gun — a .38-caliber pistol of unknown manufacture, cops said.

Nicholls was taken to Brookdale University Hospital Center in critical condition with charges pending.

A shocking new video captures a shootout between an armed carjacker and an off-duty cop in Brooklyn early Wednesday.

The officer was not struck during the incident, but was taken to Mount Sinai Beth Israel for tinnitus, authorities said.

Authorities do not believe the suspect knew the man was a cop.

He has a lengthy criminal history, with at least seven unsealed arrests dating back to 2011, according to police. The most recent bust was for alleged vehicular manslaughter in April 2019.