One dog may bark at you but it’s more likely that a pack will attack you.
We are not exempt from that behavior because we are human and not canine. As evidenced by dogs operating in a pack environment, human society is based on group dynamics.
As humans, we have instinctual responses that are exacerbated by group influences.
What we might not do as individuals we may do as part of a group. People may lose control of their usual inhibitions, as their mentality becomes that of the group.
You have never heard of a peaceful riot. Riots are by definition violent in nature.
All a riot is, is violent group behavior. The larger the group the greater the amplification of that group behavior. If the group behavior is peaceful, exemplified by Martin Luther King and Ghandi, the group behavior is peaceful and orderly.
If the group behavior is violent, the larger the group the more magnified the violence.
A mob mentality phenomenon has occurred throughout human history, whether witch burning, religious zealotry, political protests or reaction to perceived racial micro aggressions.
Three psychological theories address crowd behavior.
First is Contagion Theory, proposes that crowds exert a hypnotic influence on their members that results in irrational and emotionally charged behavior often referred to as crowd frenzy.
Second is Convergence Theory that argues the behavior of a crowd is not an emergent property of the crowd but is a result of like-minded individuals coming together. If it becomes violent is not because the crowd encouraged violence yet rather people wanted it to be violent and came together in a crowd.
Third is Emergent-Norm Theory that combines the two above arguing that a combination of liked-minded individuals, anonymity and shared emotions leads to crowd behavior