2 of my great great uncles were U. S. Marshalls, except that way back when they were referred to as "Peace Officers" in them thar parts. They were appointed.
Now, when I lived in Maricopa County, Arizona (Phoenix), Sheriff Joe Arpaio was reelected time after time.