During any hearing held under this chapter, or pending revocation of a provisional discharge, the court may order the committed person or proposed committed person temporarily confined in a jail or lockup but only if:
(1) there is no other feasible place of confinement for the person within a reasonable distance;
(2) the confinement is for less than 24 hours or, if during a hearing, less than 24 hours prior to commencement and after conclusion of the hearing; and
(3) there are protections in place, including segregation of the person, to ensure the safety of the person.
(a) A person who is being petitioned for commitment under this chapter and who is placed under a judicial hold order under section 253B.07, subdivision 2b or 7, may be confined at a Department of Corrections or a county correctional or detention facility, rather than a secure treatment facility, until a determination of the commitment petition as specified in this subdivision.
(b) A court may order that a person who is being petitioned for commitment under this chapter be confined in a Department of Corrections facility pursuant to the judicial hold order under the following circumstances and conditions:
(1) The person is currently serving a sentence in a Department of Corrections facility and the court determines that the person has made a knowing and voluntary (i) waiver of the right to be held in a secure treatment facility and (ii) election to be held in a Department of Corrections facility. The order confining the person in the Department of Corrections facility shall remain in effect until the court vacates the order or the person's criminal sentence and conditional release term expire.
In no case may the person be held in a Department of Corrections facility pursuant only to this subdivision, and not pursuant to any separate correctional authority, for more than 210 days.
(2) A person who has elected to be confined in a Department of Corrections facility under this subdivision may revoke the election by filing a written notice of intent to revoke the election with the court and serving the notice upon the Department of Corrections and the county attorney. The court shall order the person transferred to a secure treatment facility within 15 days of the date that the notice of revocation was filed with the court, except that, if the person has additional time to serve in prison at the end of the 15-day period, the person shall not be transferred to a secure treatment facility until the person's prison term expires. After a person has revoked an election to remain in a Department of Corrections facility under this subdivision, the court may not adopt another election to remain in a Department of Corrections facility without the agreement of both parties and the Department of Corrections.
(3) Upon petition by the commissioner of corrections, after notice to the parties and opportunity for hearing and for good cause shown, the court may order that the person's place of confinement be changed from the Department of Corrections to a secure treatment facility.
(4) While at a Department of Corrections facility pursuant to this subdivision, the person shall remain subject to all rules and practices applicable to correctional inmates in the facility in which the person is placed including, but not limited to, the powers and duties of the commissioner of corrections under section 241.01, powers relating to use of force under section 243.52, and the right of the commissioner of corrections to determine the place of confinement in a prison, reformatory, or other facility.
(5) A person may not be confined in a Department of Corrections facility under this provision beyond the end of the person's executed sentence or the end of any applicable conditional release period, whichever is later. If a person confined in a Department of Corrections facility pursuant to this provision reaches the person's supervised release date and is subject to a period of conditional release, the period of conditional release shall commence on the supervised release date even though the person remains in the Department of Corrections facility pursuant to this provision. At the end of the later of the executed sentence or any applicable conditional release period, the person shall be transferred to a secure treatment facility.
(6) Nothing in this section may be construed to establish a right of an inmate in a state correctional facility to participate in sex offender treatment. This section must be construed in a manner consistent with the provisions of section 244.03.
(c) The committing county may offer a person who is being petitioned for commitment under this chapter and who is placed under a judicial hold order under section 253B.07, subdivision 2b or 7, the option to be held in a county correctional or detention facility rather than a secure treatment facility, under such terms as may be agreed to by the county, the commitment petitioner, and the commitment respondent. If a person makes such an election under this paragraph, the court hold order shall specify the terms of the agreement, including the conditions for revoking the election.