A 47-year-old Brooklyn man was shot and killed by police after he tried to kill his ex-girlfriend in their Midwood apartment building.

Officers were called to 820 Ocean Parkway around 7:30 p.m. Monday where they were informed that a man, later identified as Francisco Carvajal, was trying to kill his ex-girlfriend, Kataryzna Russo.

Reports say when Carvajal, who also owns a unit inside the apartment building, entered his ex-girlfriend’s unit he found her inside along with her two children, ages 7 and 9.

The two began to argue, then at some point during the argument Russo became fearful of her ex so she grabbed her two children and seek refuge in the bathroom.

It’s unclear who called 911, but when officers arrived they found Carvajal still inside the building and the new boyfriend, Rafael Laureano, outside the locked front door.

Reports say Laureano, a bodybuilder whom Russo met at a gym, forced his way inside where he encountered Carvajal holding a knife.  Carvajal began stabbing Laureano and during the melee, police opened fire hitting Carvajal at least eight times.

Laureano was also shot once in the leg.

He died at the scene.

As of press time it was unclear whether he died from the gunshot wound or knife wounds.

Carvajal was rushed to hospital, where he died.

No one else was injured in the incident.