An off-duty NYPD police officer trying to buy a car was shot and critically wounded Saturday night in Brooklyn during an attempted robbery, officials said. The gunman is at large. 

The shooting occurred at about 7 p.m. local time after the off-duty officer arrived at a prearranged meeting spot to look at a vehicle, NYPD Assistant Chief Michael Baldassano said in a Friday night news conference. The officer had also brought a relative, Baldassano said.

“Almost immediately, the suspect displayed a gun and announced a robbery,” Baldassano told reporters. “There was an exchange of gunfire, where the off-duty officer was struck.”

The suspect fled, and the officer was rushed to a Brooklyn hospital, where he was listed in critical condition, NYPD Commissioner Keechant Sewell said. The officer’s name was not immediately released.

The officer’s relative was not injured.

The officer, a five-year NYPD veteran, had arranged the meet-up on social media, Baldassano disclosed.

New York City Mayor Eric Adams confirmed the wounded officer was married and had children.

“An officer conducting a simple errand, and a dangerous person pulled out a firearm, as we so often see in this city,” Adams said. “Too many illegal guns are in the hands of bad people and doing bad things.”

No further details were provided, including whether the officer was armed or fired at the suspect. No suspect description was immediately released.