Mercer County Prosecutor Joseph Bocchini said the suspect opened fire on the detectives as he was exiting a home and the detectives were getting out of their car.
Detective Edgar Rios was shot in the back, while Detective James Letts was struck in the shoulder. Both officers were alert and talking as they were being taken to Capital Health Systems in Trenton for treatment.
The initial incident took place on Hobart Avenue at 2:30 a.m. Officers responded, drove the female victim to the stationhouse and took down her statement. They then obtained a warrant for her boyfriend's arrest.
Armed with the arrest warrant, officers returned to the house at 8:43 a.m. for a follow up investigation with the victim.
As the boyfriend was leaving the house and was at the top of the stairs, the woman said: "That's him, arrest him," Bocchini said.
The suspect immediately pulled his revolver and opened fire. The suspect was fatally shot by police in the return fire. Bocchini said more than a half dozen bullets were fired in Thursday morning's encounter.
"When you walk into a domestic violence situation you never know what's going to happen," he said.
The woman had been "pretty severely injured" in the early morning assault, the prosecutor said. He said a puppy also was stabbed during the initial incident.
The suspect has not been identified.
Rios is a 30-year police veteran. Letts has been a police officer for 15 years.
The shooting occurred in the middle of an upsurge in violence in Trenton, an impoverished city of 84,000 where there had been 29 homicides prior to Thursday's shootout. The record of 31 was set in 2005.
Trenton's police force has been depleted due to budget cuts and is down by about 100 officers, authorities have said, with state police providing assistance.
Mayor Tony Mack wrote Gov. Chris Christie two weeks ago seeking $10 million in additional state aid to hire 75 police officers this year to address the wave of violence.
Christie said he would not deal directly with Mack, whom he referred to as "the indicted mayor of Trenton." Mack has denied any wrongdoing and remains office while awaiting trial on federal corruption charges.
The governor has said he is reviewing the public safety situation in Trenton with the attorney general's office.
Some information from The Associated Press and 6abc.com.