When there is no jail or other penal institution in a county, or the jail or other penal institution of the county is insufficient, the sheriff may commit any person in his custody, either on civil or criminal process, to the nearest sufficient jail of another county, and the warden of the jail of such county shall receive and confine such committed person , until removed by order of the court having jurisdiction of the offense, or discharged by due course of law.
730 ILCS 125/9