This situation reminds me of an interesting series on the first UK police force, how basically it grew out of robber gangs and went back and forth between a force for good and a force for consolidating power at the cost of ordinary citizens.
https://www.youtube.com/watch?v=XvMQY_y4qx8