Self-defense is not considered a homicide under a few reasonable conditions.
Someone is believed to be in imminent danger
The attack is unprovoked
Deadly force is necessary for protection.
The event takes place where you are legally allowed to be (in your own home, at a place of business, or in a vehicle).