The suspect who fatally shot an NYPD sergeant and wounded a second sergeant before being killed by police in the Bronx had an extensive criminal history, according to NYPD Commissioner James O’Neill.

“A preliminary review of the suspect’s history reveals 17 prior arrests within Suffolk County, New York, where we believe he has been living,” O’Neill said during a news conference Friday night.

Manuel Rosales’ latest arrest was on July 29 for criminal contempt of court, police said. Court records list an additional aggravated harassment charge in Suffolk’s domestic violence court. He posted $1,000 bail and was due back in court on Nov. 16.

The charges arise out of an incident in which Rosales grabbed a woman’s hair and shook her head back and forth, according to a law enforcement source. This incident happened in July at the Rosales home on Shirley Street in Bohemia, the source said.

Police said the previous arrests include one from January 2005 for obstructing governmental administration; an arrest on March 27, 2005, for having contraband in jail; on April 26, 2010, when he was arrested in a felony assault, which may have involved a police officer; January 2015 arrest for third-degree misdemeanor assault; a June 2015 arrest for criminal possession of stolen property; and a second arrest in June 2015 for criminal trespass. Dispositions for the arrests were not immediately available.

Records show Rosales has served time in prison upstate, most recently for a conviction of fourth-degree criminal contempt of stolen property.

In Brentwood, where police said Rosales was living, a man who identified himself as the suspect’s father said his son had gone astray early in his life.

“It looks like they killed my son,” said a man who said his name was Manuel Rosales. He added that he had tried to stop his son from misbehaving when he had brushes with the law as a teenager but that the criminal justice system was too lenient on him.

“Even when parents want to help the children, the system is in bad shape,” Rosales said. “When he was 16, a judge told me that he was emancipated and I couldn’t tell him what to do.”

The elder Rosales said that his son likely went to the Bronx address to confront his estranged wife, with whom he was embroiled in a custody dispute over their 3-year-old child.

“She took their child to the Bronx and put an order of protection on him because she was using the child to fight him,” said Rosales, who owns a small construction company. “When he came to a Halloween party here that we had with costumes, my children came with the grandchildren and the only child missing was his and when he left I knew he was feeling sad.”

Rosales didn’t specify what incidents his son had been involved in, but he lamented his untimely death.

“In the last few years he had changed a lot, straightened out his life” when he married, the elder Rosales said, adding that his son had problems “over the child.”

Rosales opened fire on police as they responded to a report that he had broken into his estranged wife's home in the Bronx's Van Nest neighborhood, according to police.

Sgt. Paul Tuozzolo was shot in the head and Sgt. Emmanuel Kwo was wounded in the leg. Both were taken to Jacobi Medical Center, where Tuozzolo was pronounced dead, police said. Kwo was released from the hospital after being treated for his injuries.