A 44-year-old man is in custody after allegedly shooting his roommate and two police officers who responded to a 911 call on Sunday night.

The shooting took place around 9 p.m., inside a building at 42 Hawthorne Street in Prospect Lefferts Gardens. The officers, who were told a man had been shot in the building, arrived and were reportedly fired upon while heading up the stairs. One officer was struck in his bulletproof vest, while the other was grazed.

According to the NYPD, the officers returned fire, and the suspect barricaded himself in the apartment. He was eventually taken into custody, and officers found his roommate, 45, with a gunshot wounds in both legs. The Post says that roommate had called police while hiding in a closet.

The unidentified roommate was taken to Kings County Hospital and is in stable condition. An NYPD spokesperson described the officers' injuries as minor; they were also taken to Kings County Hospital for treatment.

The NYPD said two firearms were found in the apartment. The investigation is ongoing.

With reporting by Andy Mai.