Is not about legalizing gangs, most latin america countries have been using culture/cultural movements and even sport to drive gangs members into the society.
Hiphop, street art, basketball, etc, are just easy and cheap methods to fight the delinquency problem, same as in the US.
You can go to any place filled with gangs, and follow the basic recipe: build a basketball court, build some cultural center and have it filled with organized neighborhood vigilance and in few yours you pretty much removed a big part of the problem, you will end up with some famous basketball players and some famous rap artists emerging from this community.