An off-duty NYPD officer shot himself in a car in Brooklyn on Saturday morning, the city police department said.

The shooting happened at Wythe Ave. and Williamsburg St. in Williamsburg, according to the police department.

Officers had responded around 11:05 a.m. to a 911 call of a man shot.

Police said when they arrived at the scene, they found the man — who they learned shortly after is a police officer — in the front passenger seat of a Honda Accord with an apparent self-inflicted gunshot wound.

Sources said it was a suicide attempt.

The officer was transported to Elmhurst Hospital and is in stable condition. His identity has not been disclosed at this time.

The investigation is ongoing.