An off-duty housing cop was shot early yesterday morning in Brooklyn as he was driving home from work, cops said.

Juan Medina, who works out of Public Service Area 3 on Central Avenue, and another off-duty cop were driving on Putnam Avenue and Marcus Garvey Boulevard in Bedford-Stuyvesant at around 2:50 a.m. when they encountered a group blocking the street.

Medina was taken to Bellevue Hospital, treated and released. The other officer was not injured.