If you shoot someone in self-defense, it may be legal. It's important to remember, though, that your life actually has to be in danger, or you have to think you're likely going to be killed. Shooting a firearm is to be viewed as a last-ditch effort to save your own life, where you believe you'll die if you don't do it.
This does get to be a tricky area in court, because the jury may not think you were in as much danger as you thought you were in. That's why it is so crucial to think about this before discharging the firearm. If you don't, you can still be charged, even when crimes were being committed.
For example, one man heard noises outside and looked out the window to find a number of people breaking into his car. Grabbing a gun, he went out and shot it a few times. It was later argued that he'd been shooting warning shots, but he still hit one of them, and the would-be thief was killed.
The man who shot him was still charged. Yes, it was his car, and they had no right to break in. Yes, they were breaking the law by trying to rob him, and he was trying to protect his property. However, the man's life was not in danger, so he still faced charges and had been in the wrong in the eyes of the law.
If you're facing charges for a violent crime and you believe you acted in self-defense, it is absolutely crucial that you know your rights and how the law looks at self-defense. It is a viable defense to charges in many cases, and you must know how you and your legal team can protect yourself in court if you first had to protect your own life.
Source: The Truth About Guns, "Self-Defense Tip: Don’t Shoot Anyone Who Isn’t Threatening Your Life," Robert Farago, accessed Oct. 07, 2016