He is Starfleet, though. Or at least he wears the arrowhead. Indeed, we never learn of a civilian police organization in the UFP, only of these "Federation Security" spooks, who nevertheless deliver McCoy to this Starfleet gaol. Which is sort of funny: TOS suggests that jails no longer exist and crime is an illness for which there is a cure, but the need for a police force to bring the criminals to the asylums for the cure should still remain, and it's a fairly odd job for the military to handle. Out in the frontier, yeah, all right, but in San Francisco?
McCoy probably was on Starfleet grounds when caught - the whole city might count there. And he was Starfleet himself. Perhaps there does exist a separate civilian thief-catcher force that also supplies the likes of van Gelder with patients, and crime is simply so rare that we never ever see the slightest glimpse of this force in any Trek adventure?
Timo Saloniemi