The solution is for the police to retreat. . .stay in the precinct building and let “survival of the fittest” cull the herd. The role of law enforcement is meant for a civil society. When society is no longer civil, than it is only the laws of nature that will rule over humans as mere animals. . .the only problem, humans were destined for something higher than to be ruled by a “survival of the fittest” rule of the jungle. . that is, when humans reduce themselves to animal-status. ..we become not animals, but rather, evil monsters.
Another solution is for the police to pick a side, and stick with it. They could declare that if somebody shoots a known thug, they will not care, they will not investigate, and they will not arrest.