There are several lines of evolution for modern policing.
The US instance is one.
Robbert Peele's "Peelian Principles" (UK) are another, which is how the UK ended up with a largely unarmed and civillian institution "policing by consent". (It also has its darker elements, but that's the thumbnail sketch.)
https://en.wikipedia.org/wiki/Peelian_principles
A French "gendarme" is literally a "man at arms", and is derived from military forces, representing a third tradition.