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.
There were also a lot of statements from police leadership that this incident wasn't acceptable or normal police procedure which is a drastic change from in the past where you had people staying silent or even defending and rationalizing the perpetrators actions.
The looting and rioting weaken a cause that after many years of being in the spotlight seemed to have reached a tipping point of overwhelming agreement.