NEW YORK - A rampaging gunman killed an elderly man, his son-in-law and grandson in their apartment yesterday, then fell off a fire escape to his death while trying to get away, police said.

Hector Quinones - who knew one of his victims from prison, police said - wounded a woman and terrorized another family member who found him in their third-floor walkup apartment.

Police found Carlos Rodriguez Sr., 52; and his son, Carlos Rodriguez, 24; shot to death in an apartment bedroom. Rodriguez Sr.'s father, Fernando Gonzalez, 87, was dead in a bathroom, possibly after being stabbed with a bloody knife recovered in the kitchen, they said.

Also discovered in the apartment in the rear of the walk-up building were a large stash of heroin and a semiautomatic handgun believed to be the murder weapon, chief police spokesman Paul Browne said.

Police said Quinones, 44, had recently been released from prison after serving time for manslaughter, and had known the elder Rodriguez from prison in the 1990s. The elder Rodriguez had served sentences for several drug convictions, police said.

The family lived on a busy street of bars and eateries in a tree-lined residential neighborhood a few blocks from Central Park and the American Museum of Natural History.

Giselle Rodriguez - who was married to Carlos Rodriguez Sr. was wounded and hospitalised in stable condition.