The police was invented as the exact opposite of protecting the public. To protect the government, the rich and the powerful, the system, all from the public under the pretense of protecting the public.
It depends in where you want to stick that 'invented' label. The principles of Sir Robert Peel, arguably the father of modern policing, are very different:
https://en.m.wikipedia.org/wiki/Peelian_principles