An elected sheriff is the highest law enforcement officer in his county. Whether he acts that way is a different issue.
In my state sheriffs are state officers directly under the governor’s authority.
They can and have removed sheriffs from office and can order a sheriff to suppress any lesser state law enforcement officer.
Any municipal officer who resists the governor’s orders commits insurrection, which is usually dealt with by the state National Guard at the governor’s direction.
Sheriff’s powers are a creation of State law and vary WIDELY from State to State.
Ask Darryl Daniels and Scott Israel after they were removed from office by the Florida Governor. Or Kenny Boone who was removed by the South Carolina Governor.
Removal procedures and powers vary as well. In New York: “ The governor may remove any elective sheriff, county clerk, district attorney or register within the term for which he or she shall have been elected; but before so doing the governor shall give to such officer a copy of the charges against him or her and an opportunity of being heard in his or her defense.”
In Maine: “Whenever the county commissioners find that the sheriff is not faithfully or efficiently performing any duty imposed by this chapter or that the sheriff is improperly exercising or acting outside the sheriff’s authority, the commissioners may file a complaint with the Governor describing in detail the facts of those actions or omissions and requesting the Governor to remove the sheriff from office and appoint another sheriff in that office for the remainder of the term.”
In some States (mainly in the northeast), Sheriffs don’t even have general law enforcement responsibilities.