We further note that respondent also sought an order “requiring Mid-State Correctional Facility to create the least restrictive setting on [its] campus to house individuals in similar circumstances to [respondent] normally during the pendency of the probable cause hearing [pursuant to Mental Hygiene Law article 10] having taken place.” We therefore convert respondent’s habeas corpus proceeding to a declaratory judgment action (see CPLR 103 [c]; People ex rel. Padilla v Rodriguez, 145 AD2d 922 [1988]).
With respect to petitioner’s appeal, we conclude that the court exceeded its authority in determining that respondent and all other sex offenders detained at Mid-State after the expiration of their sentences pursuant to article 10 of the Mental Hygiene Law must be afforded the same conditions as those inmates held in long-term protective custody in Building 10-2 at Mid-State. Persons such as respondent who are placed in protective custody by prison administrators are subject to the conditions of confinement set forth in the protective custody regulations issued by the Department of Correctional Services (see 7 NYCRR 330.4; see also 7 NYCRR 301.5). Thus, we agree with respondent that, because he was placed in protective custody, he was entitled to the “ [conditions of confinement” set forth in 7 NYCRR 330.4, and we grant judgment accordingly. Nevertheless, petitioner is correct that the conditions of confinement for inmates in Building 10-2 are more favorable than those required by the regulations applicable to protective custody inmates. Because prison administrators have broad discretion to determine, based upon security concerns, whether persons such as respondent should be afforded the less restrictive conditions in Building 10-2 (see generally Matter of Rivera v Smith, 63 NY2d 501, 512-513 [1984]), we agree with petitioner that prison administrators have discretion to place a person eligible for protective custody in administrative segregation, a more restrictive placement, where such placement is “required for the security of the facility and the safety of the [detained person]” (Matter of Rifkin v Goord, 273 AD2d 878, 879 [2000]). We therefore further grant judgment accordingly.
Finally, we conclude with respect to the cross appeal of respondent that, based on his consent to confinement in a secure