The gun wasn't legal, he had previously been charged with weapon possession as a felon. I'm sure the cops knew him and also knew he likely had a gun on him and was a danger.
It's crazy we have people constantly clamoring for more gun restrictions, yet this human piece of garbage, who is part of the core source of gun violence in this country, gets shot while possessing an illegal gun and firing at police... and just like clock work those same people rush to defend him and attack the police. It shows how unserious they really are.