Police accidentally shot and killed a Brooklyn man they were trying to save from a knife-wielding assailant.

An autopsy shows 51-year-old Rafael Laureano died Monday night from a single gunshot wound to the back, according the a spokeswoman for the medical examiner.

Officers also killed the suspect, 47-year-old Francisco Carvajal.

Police said they saw Carvajal stabbing Laureano aftern they arrived at an apartment where a disturbance was reported, and they ordered the man to drop his knife.

ADVERTISEMENT

Officers fired at least 12 shots when Carvajal refused, and both men were killed.

The autopsy showed Carvajal had 13 bullet wounds, including entry and exit wounds and one graze wound, investigators said.

The medical examiner said one of the bullets that killed Carvajal may have struck Laureano in the back.

Carvajal was the ex-boyfriend of a woman who lived in the apartment, and Laureano was her current boyfriend.

The woman and her two children, who locked themselves in the bathroom during the incident, were not injured.

ADVERTISEMENT

Watch this video report posted online by WNBC-TV: