Your analysis certainly has merits. I think that that is why a lot of schools throughout Denver are still struggling. My own high school saw better results though, largely because it has an excellent administration which realized that improving the overall environment of the school was key.
To tackle the problem of gangs around school, there were a couple of important changes our last principal initiated, that other schools in the area did not necessarily pick up on. 1) Strictly enforce a ban on certain types of clothing that were being used to display allegiance to given gangs. 2) Increase the amount of open spaces for students to stay in while not in classes. 3) Require that students show up to school each morning, even if they do not have classes that morning. 4)Encourage students to stay inside during school hours, even when they have off blocks. 5) Have police/security officers at school introduce themselves to students, and engage students in conversation to get to know them.
On the whole the principal was very engaging so it was thanks to these programs that the gang problem was not as bad when I left compared to when I entered. In this case the heightened role of security was leveraged to have some positive effects, something not seen at other schools where there is a fundamental lack of trust between students and security. Trust and positive engagement are key, but achieving that is difficult.