Homicide is illegal in every state.
However, in states with castle or stand your ground laws, you are not even arrested and charged with a crime if you kill someone in those specific circumstances. These exceptions are part of the laws on homicide.
But other states do not have these laws. Like Connecticut, where I live. If I kill someone who is in the act of committing a home invasion on my property, I can be arrested. Whether I am indicted and stand trial is completely up to the District Attorney. But even then, it's possible I can be acquitted if the jury finds I acted in self-defense. Or not. I could be found guilty and have to pay the penalty. If I don't like that, my only recourse is to move to another state. If I can't move for whatever reason, and I don't want to gamble my freedom on an unpredictable jury, then it would behoove me to avoid killing someone, even in self-defense.
*MySmiley*
"Bustin' makes me feel good!"
Ghostbusters, by Ray Parker Jr.