A 51-year-old retired NYPD officer shot a fellow tenant in the head before barricading himself inside an apartment building in Greenpoint, Brooklyn, Monday afternoon, police said.

The former officer, Gene Barrett, 51, had an ongoing dispute with the 45-year-old victim and his girlfriend, who also lived on Greenpoint Avenue, police said.

That dispute culminated just before 2:35 p.m. Monday when Barrett shot the victim once in the head, they said. He then barricaded himself at the address, but officers were able to talk him into surrendering and he was taken into custody unharmed.

The victim, who was found on the sidewalk outside of the building, was taken to Bellevue Hospital Center. He remained in critical condition, as of Tuesday morning, police said.

Barrett was charged with attempted murder, among other charges. Two firearms were recovered at the scene, according to police.

Barrett retired from the police department in August 2002.

No police officers were injured during the confrontation, the department said.

With Nicole Brown