An NYPD officer was hit by a car in Brooklyn early Saturday while helping to rescue a man who had been kidnapped from the Bronx, police said.

The victim, 32, was taken against his will from an unspecified spot in the southwest Bronx just after midnight by two men who demanded a ransom of cash and jewels.

A friend of the victim called cops, who pretended to meet the kidnappers’ demands by placing a bag at Fulton Street near Arlington Place in Bedford-Stuyvesant, police said.

As officers surveilled the bag, they spotted a man who jumped out of a car and tried to retrieve the “ransom.”

The suspect ran as investigators surrounded the vehicle, but cops caught up to him. Charges are pending.

Just minutes later, in a scene straight out of an action flick, another car raced past the scene and the victim was shoved out. That car then hit a police officer and fled, authorities said.

The injured cop was taken to an area hospital with non-life-threatening injuries.

Cops are still searching for the runaway vehicle.