Two plainclothes New York City police officers were shot in Brooklyn early Saturday during an exchange of fire with a gunman who had led officers on a brief car chase, officials said.

The shooting happened around 3:20 a.m. after the suspect, Jamal Funes, 34, drove his car head-on into a marked patrol vehicle as he was driving the wrong way on Lexington Avenue near Malcolm X Boulevard in Bedford-Stuyvesant, the police said. Mr. Funes was shot and was in stable condition at Brookdale University Hospital and Medical Center.

Officer Andrew Yurkiw, 29, was shot in the chest and suffered blunt-force trauma after the bullet was stopped by his bullet-resistant vest, the police said. Officer William Reddin, 33, was shot in the right hip. The officers were taken to Kings County Hospital Center, where they were listed in stable condition, the police said.

Investigators were trying to determine on Saturday afternoon if the officers had been shot by the suspect or by other officers, the police said.