The concept of police and their duties, presence, and compensation, are essentially seen in today's society as if this has always been the norm and always will be the norm, but that simply isn't the case whatsoever. There wasa time, when police, especially in their everyday duties and expectations, didn't really exist, instead communities would handle their law enforcement needs typically through a less formal system, a far less invasive system, involving watchmen, offer voluntary or compulsory as a duty to the community, with a constable or sheriff in charge who answered to the civic leaders of a given community, and the payment for these men was often based on tasks accomplished, such as the serving of writs, the collecting of taxes, and the apprehending of those accused of crimes.
The advantage of the previous form of policing was the fact that the crimes that the sheriff responded to typically dealt with robbery, property theft or damage, public drunkenness, public fighting, murder, and prostitution, in which often times, the watchmen responded to crimes as perceived by citizens that were directly affected by them. This also meant that the sheriff would as a matter of course; respond to crimes taking into account the property ownership and social status of the citizen engaging with them. That is to say, sheriffs and their watchmen were in essence, primarily there to protect the status quo from theft, damage, harm, and public nuisances.
Today's police force has a chain of command, and that chain of command doesn't really take into account that the law should be equally and fairly applied, but to the contrary, that the law is purposely opaque, subject to all sorts of interpretation or misinterpretation, arbitrary, endless, contradictory, all for the given purpose so that the police as designated agents of the State, can without much meaningful controversy, arrest and deal with the common man in a manner that quickly allows the State to keep order, so as to protect the vested interests of those that are important or have significant assets, from outside elements that would destroy wealth or the public order.
When the police designate on their government vehicles that they are here to "protect and serve", that motto isn't fundamentally meant for the people that own nothing, have no real opportunity, and are barely able to make ends meet, but instead all that protecting and serving is in reality designated for the privileged people of the community and really nobody else.
The foremost duty of the police in essence is to protect and to serve the status quo, at all times, for the very reason, that if they fail to do so, they will summarily be replaced by those that will not fail to do so.
The police answer to their paymasters, and those paymasters are the leaders both civic and private of that community, to which, their primary desire of those leaders is not to have trouble, because trouble is bad for business, and bad business is bad for their pocketbook as well as being inherently destabilizing, so that, the best way to take care of trouble is to use the domestic policing arm of the community to crush the bad elements, typically by demonstrating overwhelming force, and if necessary, by using that same force until the opposition is put to heel.