The state appeals the order of the circuit court equiring that petitioner be released from the custody f the defendant Sheriff of Clackamas County.1 We everse.
Petitioner filed a petition for a writ of habeas orpus seeking release from the Clackamas County ail where he had been confined after a conviction for riving while suspended. He was tried as an adult lursuant to ORS 419.533(3),2 although he was under 8 years of age when he was convicted. He is now 18 ears old.
The Clackamas County jail has a separate section or juveniles and petitioner was housed in that section, le was placed in the juvenile section by the chief ailer because his age and size caused some concern for as safety in the adult side of the jail. Testimony taken t the hearing and the affidavit accompanying the letition indicated that the juvenile portion of the jail ras not intended for long term custody but was design-d and used primarily for temporary detention pend*414ing committment to a more permanent juvenile facility. There was no job training, educational or recreational program available to the juveniles held in that portion of the jail.
The circuit court found that there was no legal basis for housing a person who had been tried and convicted as an adult in the section of the jail designed for temporary detention of juveniles and ordered petitioner released.
The state contends that the trial court erred in deciding that a writ of habeas corpus was available to petitioner in the circumstances of this case and that, even if a writ was properly available, the remedy should be transfer to the adult side of the jail and not released from custody altogether.
Penrod/Brown v. Cupp, 283 Or 21, 581 P2d 934 (1978), held that a writ of habeas corpus is now available to prisoners challenging the conditions of their confinement in two kinds of circumstances: (1) where the prisoner, although validly in custody, is subjected to a further "imprisonment or restraint” of his person that would be unlawful if not justified to a court and (2) where an alleged deprivation of the prisoner’s rights requires immediate judicial scrutiny which is not available through other means. There has been no contention that the second situation is involved here.
The trial court found that petitioner was placed in the Clackamas County jail by a lawful order but that his incarceration in the juvenile facility amounted to an "additional measure of 'imprisonment or restraint.’ ” This type of "prison within a prison” situation is similar to those cases in which prisoners claim that they are or have been unlawfully placed in solitary confinement. The remedy in such cases is to order the prisoner released only from the additional restraint and not from custody entirely. See Penrod/Brown v. Cupp, supra; Bekins v. Cupp, 274 Or 115, 545 P2d 861 (1976).
*415We agree with the trial judge that a writ of habeas jrpus is available in the circumstances of this case, owever, the remedy granted was not the proper one. petitioner was unlawfully assigned to the juvenile de of the jail, and if this assignment amounted to a irther imprisonment or restraint, the remedy is ansfer to some other place of custody. Petitioner íould not have been released.
Reversed and remanded for entry of an appropriate der.
ORS. 34.710 authorizes appeal by the state from the final judgment in habeas corpus proceeding:
" Any party to a proceeding by habeas corpus, including the state when the district attorney appears therein, may appeal from the judgment of the court refusing to allow such writ or any final judgment therein, either in term time or vacation, in like manner and with like effect as in an action. No question once finally determined upon a proceeding by habeas corpus shall be reexamined upon another proceeding of the same kind.”
ORS 419.533(3) provides:
"(3) The juvenile court may enter an order directing that all cases involving violation of law or ordinance relating to the use or operation of a motor vehicle, boating laws or game laws be remanded to criminal or municipal court, subject to the following conditions:
"(a) That the criminal or municipal court prior to hearing a case, other than a case involving a parking violation, in which the defendant is or appears to be under 18 years of age notify the juvenile court of that fact; and
"(b) That the juvenile court may direct that any such case be remanded to the juvenile court for further proceedings.”