In my state (Arizona) The County Sheriff is the highest ranking law enforcement in the county. His jurisdiction includes all cities, towns and villages. City or town PDs do not have jurisdiction outside of the city or town limits. When I was a deputy sheriff we were taught in the academy we had the authority to enforce all laws, Federal, State, County, and town or city, according to the State Constitution.
I was a deputy in the 1970 and 1980s. I don't know how much that had changed from the 19th Century, nor do I know how it might have changed since I retired, in this the 21st Century.
Dave