A bodybuilder who intervened to stop a knife attack against his girlfriend in Brooklyn was killed by a bullet fired by police, the city medical examiner said Wednesday.

Rafael Laureano, 51, died after he sustained a perforating gunshot wound to his back Monday night. His death was ruled a homicide, according to the medical examiner.

The designation of homicide means the death was caused by another person's actions and is not a statement of legal culpability, according to a spokeswoman for the medical examiner.

A police spokesman said it was unclear if Laureano sustained his wound from a bullet which passed through the body of the attacker, Francisco Carvajal, or from a ricochet.

According to police, Laureano entered the seventh floor apartment of his girlfriend Kataryzna Russo at 820 Ocean Parkway after officers breached the locked door. The officers were responding to a 911 call that the woman was being attacked by Carvajal, her ex-boyfriend, investigators said.

Laureano then rushed past police before he could be restrained and got into a confrontation with the knife-wielding Carvajal who had been trying to break into the bathroom where a terrified Russo was hiding with her two children, said law enforcement officials. Carvajal stabbed at Laureano a number of times and then turned toward officers who shot him dead. The autopsy found that one of the police bullets struck Laureano, who was pronounced dead at Maimonides Medical Center.

Neither Russo, 35, nor her children ages 6 and 7, were hurt in the incident. Police recovered two knives at the scene.

The shooting is likely to be submitted to the Brooklyn district attorney's office for review. An NYPD spokesman said the officers were treated from tinnitus.