Any organized township, municipality, or county of the state is hereby authorized, upon passage of an affirmative resolution by each of the governing bodies of two or more such subdivisions of the state, to enter into a mutually acceptable contract, or to amend or terminate such contract, by which a jail may be used, owned, constructed, maintained, or operated, or any of the foregoing relationships may be established, by such two or more subdivisions.
SDCL 24-11-4