It could've been easily prevented by actually arresting someone that committed abject murder, but the city and the police chose to instead defend a man who has killed multiple people in the past and got away with it scott-free. So when people feel like justice no longer exists, there should be no surprise that they get angry.
It doesn't help that the police also employ agent provocateurs whom help incite riots and looting so that they can use more violent tactics with glee.
Then we'll have to agree to disagree, opportunists don't exist without a crowd.