TMZ has obtained gory photos and details from the violent confrontation at Miranda Kerr's Malibu home on Friday, but be warned ... they aren't for the faint of heart.
Kerr's neighbor tells us ... workers on the deck of his home witnessed the scary altercation. We're told an alleged homeless man jumped the fence onto Miranda's property, and that's when the security guard approached him.
Our source says ... the intruder didn't obey requests to get on the ground, and attacked the guard with a knife -- who was stabbed in the face and arm. They wrestled on the ground for a bit before separating, but when the man charged the guard again ... he opened fire.
We're told the intruder was shot 4 times -- 2 in the chest area and 2 in the shoulder. 911 was called during the fight.
The neighbor confirms Miranda moved out recently and was not at the house at the time of the incident.