Off-duty NYPD officers fatally shot a gunman in the Bronx early Sunday, police said.

The gunman, 24, and his father, 44, were involved in a dispute with a group that later turned physical, officials said. The 24-year-old man pulled out a gun and fired several times at the group.

Off-duty officers, who’d just finished work for the day and were leaving the 46th precinct, heard the shots and shouted at the man to drop his weapon, police say.

He refused and a shootout ensued, NYPD Chief of Patrol Juanita Holmes said. The gunman was struck in the torso and dropped his weapon. His father picked up the gun and fired at the officers.

Police were able to take the father, later identified as Rafael Rosado, into custody. He and the officers were not injured, WPIX reports.

The son, Mike Rosado, died at the hospital.