If you believe what you see in the movies, gun fighting (back in the day) was simply a matter of squaring off at high noon and shooting a one another until one (or both) shooters were no longer able to shoot back.
There was also the occasional ambush where one side shot at the other side from cover and without warning.
Both of these events were either legal or illegal depending on the mood of the locals at the time.
Frontier justice was rarely fair nor was it just.
Guilt was often times a matter of who got killed and their standing in society.
Kill the preacher...oops.
Kill the town terror...the drinks are on us!
Gun fighting as it was, is illegal today in most places. Yet it still happens.
Bad guys ambush good guys (Dallas PD) and bad guys ambush bad guys (Chicago gang violence).
The bad guys know that the best way to prevail is to strike first and without warning.
This extends to interactions with other parts of society as well.
If the bad guy is going to commit a robbery he\'s going to pick his mark, the time and the place that gives him the greatest advantage.