A clear understanding of the laws pertaining to self defense and justifiable use of force where you are is critical. When we do a concealed weapons license class, we spend half the course on the law. I get a lot of "I didn't know thats" in my classes.
The laws can vary greatly from one state to another, and as mentioned some overzealous law enforcement and prosecutors can push the envelope. Here in Florida, the laws governing use of force are pretty clear, and the legislature continues to tweak the law to make it harder for prosecutors to bring charges against citizens who are defending themselves. Defense of self or others from death or great bodily harm, and stopping a forcible felony give justification for the use of deadly force. Defense of property alone would rarely provide justification for use of deadly force. We have stand your ground, and recent changes in the law regarding mob actions would bring some actions into the realm of forcible felonies. The best advice pertaining to mobs is stay the hell away if you have a choice, but be prepared and knowledgeable of the law in the event you find yourself in the middle of a riot.