If the petitioner is imprisoned, the petition shall name as defendant the official charged with the confinement of petitioner. If the petitioner is not imprisoned, the defendant shall be the State of Oregon. Whenever the defendant is the superintendent of a Department of Corrections institution, the Attorney General shall act as the superintendent's attorney in the proceedings. Whenever the defendant is some other official charged with the confinement of petitioner, the district attorney of the county wherein the petitioner is imprisoned shall be the attorney for the defendant. Whenever petitioner is not imprisoned, counsel for the State of Oregon as defendant shall be the district attorney of the county in which petitioner's conviction and sentence were rendered. Whenever the petitioner is released from imprisonment during the pendency of any proceedings pursuant to ORS 138.510 to 138.680, the State of Oregon shall be substituted as defendant. Upon such substitution, counsel for the original defendant shall continue to serve as counsel for the substituted defendant.
ORS 138.570