
589 P.2d 1115 (1979)
285 Or. 75
Application of Buster OWENS for a Writ of Habeas Corpus.
Buster Owens, Plaintiff,
v.
Tom DURYEE, Sheriff of Klamath County, Defendant.
No. 78-279-C; SC 25980.
Supreme Court of Oregon, In Banc.
Argued and Submitted January 8, 1979.
Decided January 30, 1979.
Herbert A. Putney, Medford, for plaintiff.
Thomas H. Denney, Asst. Atty. Gen., Salem, for defendant.
DENECKE, Chief Justice.
The plaintiff petitioned this court for a writ of habeas corpus, alleging that the defendant sheriff was illegally imprisoning plaintiff. We allowed the writ, the sheriff filed a return, a hearing was held, and we determined that the plaintiff was legally *1116 held. This opinion is in explanation of our decision.
The plaintiff was indicted for Theft in the First Degree and was arrested. He was subsequently released on his own recognizance. At the time set for trial, December 18, plaintiff desired to change his plea and entered a plea of guilty. An order accepting and entering the plea was made by the trial court. The trial court ordered a presentence report, set February 2 as the time for sentencing, and ordered plaintiff taken into custody while awaiting sentencing.
Plaintiff contends that until he is sentenced he is entitled, as a matter of right, to be released from custody either on his own recognizance or a reasonable conditional or security release. The defendant contends that the trial court has the discretion at this stage of the proceeding whether to release plaintiff.
The general policy set by the legislature is "Except as provided in subsection (2) of this section, a defendant [awaiting trial] shall be released * * *." ORS 135.240(1). The legislature, however, also has established a policy that in the later stages of the criminal proceeding it is a matter within the trial court's discretion whether the defendant should be held in custody.
Plaintiff contends the only statute which allows any discretion to the trial court on the decision whether a defendant should be released is ORS 135.285(2) which provides:
"* * * If a defendant appeals after judgment of conviction in circuit court for any crime other than murder or treason, release shall be discretionary."
Plaintiff argues that there is no judgment of conviction until the defendant has been sentenced; that has not occurred in this case and, therefore, this statute is not yet applicable.
The defendant relies upon two other statutes. ORS 136.110 provides:
"When a defendant who has been released appears for trial, the court may in its discretion at any time after such appearance order him to be committed to actual custody to abide the judgment or further order of the court; and he shall be committed and held in custody accordingly."
ORS 136.495 provides:
"If a general verdict against the defendant is given, he shall be remanded, if in custody; if he has been released, he may be committed to await the judgment of the court upon the verdict. When committed, his release agreement is exonerated or, if he has deposited money in lieu of a release agreement, it shall be refunded to him."
The latter quoted statute requires the giving of a general verdict which did not occur in the present case; the plaintiff pleaded guilty. The defendant argues no distinction should be made between a verdict of guilty and a plea of guilty. We need not determine whether there is such a distinction or what is meant by "judgment of conviction" because ORS 136.110, quoted above, is the applicable statute. It provides that a criminal defendant can be committed to custody when the defendant "appears for trial * * *." The plaintiff was committed to custody in this case when he "appeared for trial" and changed his plea to guilty.
The legislature has selected certain stages of the criminal proceeding at which the defendant's right to release upon reasonable terms is changed to a right to be released only at the trial court's discretion. These stages are when the defendant appears for trial, ORS 136.110; when a guilty verdict is returned, ORS 136.495; and when a defendant appeals after a judgment of conviction, ORS 135.285(2).
The legislature could have provided that when a defendant appeared for trial, and at any time thereafter, it was in the trial court's discretion whether the defendant should be released. Instead, the legislature, at various times, selected various stages of the proceeding when the defendant's release changed from a matter of right to a matter of discretion.
Plaintiff also contends that even if release is within the trial court's discretion, *1117 the plaintiff is entitled to be released because the trial court abused its discretion in ordering him to be placed in custody. The trial court apparently ordered plaintiff to be placed in custody because that always was the practice of the trial court after a plea or verdict of guilty. Making a decision based upon a general practice and not on the basis of the circumstances of the individual case is not an exercise of discretion. Nevertheless, the plaintiff is not entitled to be released.
This is not an appeal from the trial court's order placing the plaintiff in custody. We cannot remand to the trial court and order it to exercise its discretion. This is a habeas corpus proceeding and our sole duty is to determine if the plaintiff is held illegally and, if he is, to order him released. If the facts, so far as they are undisputed, do not show that the detention is illegal, plaintiff is not entitled to be released. Thus we must determine whether the undisputed facts could not support the trial court's order placing the plaintiff in custody. We conclude plaintiff was not held illegally.
The circumstances justifying the trial court's order were: (1) plaintiff's plea of guilty; (2) plaintiff's knowledge that he now certainly will receive some kind of sentence; (3) the sentence can be as great as five years of imprisonment; and (4) the inevitability of a sentence and the possibility of a five-year prison sentence makes flight more attractive. People of the State of New York ex rel. Parone v. Phimister, 29 N.Y.2d 580, 324 N.Y.S.2d 311, 272 N.E.2d 894 (1971).
Knutson v. Burks, No. 25680, decided March 14, 1978, without opinion, is an example of a habeas corpus proceeding in which we concluded the plaintiff was held illegally. We determined there were no circumstances which would justify the trial court's order setting security in the sum of one million dollars while the prisoner was awaiting trial on a drug offense. Bail may not be set at an amount chosen in order to make it impossible, as a practical matter, for a prisoner to secure his release.
