2023 California Code › Penal Code - PEN › PART 3 - OF IMPRISONMENT AND THE DEATH PENALTY › TITLE 4 - COUNTY JAILS, FARMS AND CAMPS › CHAPTER 1 - County Jails › Section 4007.

4007. When there is no jail in the county, or when the jail becomes unfit or unsafe for the confinement of prisoners, the judge of the superior court may, by a written order filed with the clerk of the court, designate the jail of a contiguous county for the confinement of any prisoner of his or her county, and may at any time modify or vacate the order.
When there are reasonable grounds to believe that a prisoner may be forcibly removed from a county jail, the sheriff may remove the prisoner to any California state prison for safekeeping and it is the duty of the warden of the prison to accept and detain the prisoner in his or her custody until his or her removal is ordered by the superior court of the county from which he or she was delivered. Immediately upon receiving the prisoner the warden shall advise the Director of Corrections of that fact in writing.
When a county prisoner requires medical treatment necessitating hospitalization which cannot be provided at the county jail or county hospital because of lack of adequate detention facilities, and when the prisoner also presents a serious custodial problem because of his or her past or present behavior, the judge of the superior court may, on the request of the county sheriff and with the consent of the Director of Corrections, designate by written order the nearest state prison or correctional facility which would be able to provide the necessary medical treatment and secure confinement of the prisoner. The written order of the judge shall be filed with the clerk of the court. The court shall immediately calendar the matter for a hearing to determine whether the order shall continue or be rescinded. The hearing shall be held within 48 hours of the initial order or the next judicial day, whichever occurs later. The prisoner shall not be transferred to the state prison or correctional facility prior to the hearing, except upon a determination by the physician responsible for the prisoner’s health care that a medical emergency exists which requires the transfer of the prisoner to the state prison or correctional facility prior to the hearing. The prisoner shall be entitled to be present at the hearing and to be represented by counsel. The prisoner may waive his or her right to this hearing in writing at any time. If the prisoner waives his or her right to the hearing, the county sheriff shall notify the prisoner’s attorney of the transfer within 48 hours, or the next business day, whichever is later. The court may modify or vacate the order at any time.
The rate of compensation for the prisoner’s medical treatment and confinement within a California state prison or correctional facility shall be established by the Department of Corrections, and shall be charged against the county making the request.
When there are reasonable grounds to believe that there is a prisoner in a county jail who is likely to be a threat to other persons in the facility or who is likely to cause substantial damage to the facility, the judge of the superior court may, on the request of the county sheriff and with the consent of the Director of Corrections, designate by written order the nearest state prison or correctional facility which would be able to secure confinement of the prisoner, subject to space available. The written order of the judge must be filed with the clerk of the court. The court shall immediately calendar the matter for a hearing to determine whether the order shall continue or be rescinded. The hearing shall be held within 48 hours of the initial order or the next judicial day, whichever occurs later. The prisoner shall be entitled to be present at the hearing and to be represented by counsel. The court may modify or vacate that order at any time. The rate of compensation for the prisoner’s confinement within a California state prison or correctional facility shall be established by the Department of Corrections and shall be charged against the county making the request.
(Amended by Stats. 2002, Ch. 784, Sec. 562. Effective January 1, 2003.)