remember, the police's sole purpose is to punish crime, not to prevent it. they don't care who they punish as long as they can add your number to their statistics. they are NOT your friends. that's just childhood brainwashing.
The police' main purpose is to protect the social order internally, by enforcing social relations (foremost being property and the authority of state institutions). As for punishing crime - technically, the police is not supposed to decide whether crimes have been committed, nor to meet out out punishment for them. Really is a different thing, of course - but even then, the punishment is for police-undesirable behavi…
If the police have become a punishing force, or even make the rules, then something has gone very wrong. Now even in civilized societies things sometimes goes wrong, e.g. the parliament provides police with too broad a framework to operate within, in an attempt to be "tough on crime" or attempt to dictate the framework of the judicial system to ensure a minimum sentencing. It's just rare that the police force itself is to blame. Blame mostly falls back to the people writing the laws.