The defendant, Stephen Robert Davis, pleaded guilty to third-degree burglary, a felony. The district court sentenced Davis to five years, suspended his sentence, and placed him on probation for two years. The court impоsed two conditions of probation. First, Davis was ordered to receive inpatient treatment for substance abuse. Second, following this treatment, Davis was ordered to reside at a residential facility for 180 days or until he received maximum benefits. The district court then ordered Davis to be held in the county jail — where he was already in custody — until space became available at the treatment facility.
Davis appealed from his cоnviction and sentence, contending the district court lacked authority to impose jail time as a condition of probation. We transferred the ease to the court of appeals. The court of apрeals agreed with Davis, vacated the sentence imposed, and remanded for resentencing.
We granted the State’s application for further review. We now conclude the district court did not impose jail time as a condition of probation. Rather, the district court ordered Davis temporarily held in the county jail pending availability of space for him at the inpatient substance abuse treatment facility. Our review of the statutes leads us to conclude the legislature intended the district court to have such authority. We therefore vacate the court of appeals decision and affirm the district court’s judgment of conviction and sentence.
On October 18, 1994, the State charged Davis with burglary in the third degree, a class “D” felony. See Iowa Code §§ 713.1, 713.6A (1993). In substance, the trial information alleged that Davis unlawfully entered *455 an unlocked car with the intent to steal a radio locatеd inside.
Following his arrest on this charge, Davis was released from custody under pretrial supervision. On October 31 Davis was again in custody after having been arrested for three offenses: (1) criminal mischief in the fourth degree, (2) interference with official acts, and (3) being in a tavern as a minor.
Subsequent negotiations between Davis and the State resulted in a written plea agreement. Under the agreement, Davis agreed to plead guilty to the burglary charge. The State agreed to recommend that Davis receive a suspended sentence.
Following Davis’ formal plea of guilty, the district court accepted the plea agreement. The court then sentenced Davis to an indeterminate term of imprisonment not to exceed five years, suspended the sentence, and placed Davis on probation to the department of correctional services for two years.
The court imposed two conditions of probation. First, the court ordered Davis to attend an inpatient substance abuse treatment program at Prairie Ridge in Mason City. Second, the court ordered Davis, following treаtment, to reside at the BeJe Clark residential facility for 180 days, or until he received maximum benefits.
The court additionally ordered that Davis be held in the Cerro Gordo county jail until space became available for him аt the Prairie Ridge facility.
Just before the sentencing, Davis’ attorney asked the court to consider releasing Davis to the custody of his parents until he could enter Prairie Ridge. Davis was scheduled to enter the treatment program exactly one week following the sentencing hearing. Because of Davis’ poor performance on pretrial release for this offense, the court declined to release Davis to his parents’ custody. Instead, the court ordered Davis to remain in the county jail until space became available for him at Prairie Ridge.
Davis argues that the district court erroneously sentenced him to jail time on the felony offensе of burglary as a condition of probation. The State counters that the court did not order Davis to be confined in the county jail as a condition of probation. The court— the State says — -merely ordered Davis held in thе county jail until he could be transferred to Prairie Ridge to start fulfilling his first probationary condition. The State points to various statutory provisions which, it claims, evidence a legislative intent to grant the district court such authority.
These contentions raise the issue whether the district court had the authority to temporarily confine Davis in the county jail until space for him became available at the treatment facility. If such authority was lacking, the confinement constituted an illegal sentence.
Because Davis challenges the legality of sentence, our review is for errors at law.
State v. Morris,
To support his contention that the court sentenced him to a jail term as a condition of probation, Davis relies heavily on
State v. Tensley,
Hеre, in contrast, the district court did not expressly order Davis to serve time in the county jail as a condition of probation. Rather, the court simply ordered Davis held in the county jail until space at the treatment facility became available.
However, this explanation does not resolve the unanswered question whether the court had authority to temporarily confine Davis in a county jail until space for him became *456 available at the treatment facility. We think it did.
To resolve the question, we look to the provisions for temporary custody in statutes governing confinement and probation. Iowa Code section 901.7 establishes the procedure for incarceration. For sentences exceeding one year, the statute requires the court to commit a defendant to the custody of the director of the Iowa department of corrections. The statute also allows the court to “make an order as appropriate for the temporary custody of the defeiidant pending the defendant’s transfer to the custody of the director.” Iowa Code § 901.7.
We interpreted this statute broadly in
State v. Snyder,
Iowa Code section 907.8 governs probation:
[[Image here]]
When probation is granted, the court shall order said person committed to the custody, care, and supervision:
1. Of any suitable resident of this state;
or
2. Of the judicial district department of correctional services.
[[Image here]]
... If the defendant is confined in the county jail at the time of sentence, the court may order the defendant held until arrangements are made by the judicial district department of correctional services for the defendant’s employment and the defendant has signed the necessary probation papers.
Both section 901.7 (governing incarceration) and section 907.8 (governing probation) authorize the district court to provide for temporary custody before transfer to the custody of the entity or person responsible for a defendant’s custody, care, and supervision. As we said, we have interpreted broadly the temporary custody provision in section 901.7. We likewise interpret broadly the temporary custody provision in section 907.8. Granted, section 907.8 provides that the cоurt can order a defendant held in the county jail until arrangements are made for the defendant’s employment. The reason confinement is linked to employment is obvious. Defendants are allowed to remain in the community at community-based residential facilities so that they can remain or become employed. Employment is a necessary prerequisite to rehabilitation.
We view section 907.8 as authorizing the district court to confine a defendant in a county jail until the judicial district department of correctional services makes arrangements for the defendant’s employment. Obviously, where the court orders inpatient treatment, those arrangements would likely bе delayed until after treatment is completed. In this case there was nothing in the record to suggest otherwise. Given this broad interpretation of section 907.8, we fail to see how the district court lacked authority to do what it did.
This case is a good example of why trial judges must have authority to do exactly what the trial judge did here and why we think the legislature intended judges to have such authority. Davis admitted to the pre-sentence investigator that he had been drinking heavily before committing the offense in question. The presentence report lists a number of alcohol-related offenses in the year and a half leading up to the burglary in question: public intoxication (twice), сonsuming in public, and possession of alcohol un *457 derage. In addition, Davis was convicted of petty theft twice. He violated his pretrial release agreement when he was arrested for criminal mischief, interference with official acts, and being in a tavern as a minor.
Given Davis’ track record, the odds were good that he might commit more crime if he were allowed to roam the streets one week before inpatient treatmеnt began. The trial judge realized that and did what any reasonable judge in similar circumstances would do: keep the defendant confined until inpatient treatment could begin.
In sum, we conclude the district court did not illegally sentence Davis to jail time on the felony offense of burglary as a condition of probation. Rather, the court merely ordered Davis held in the county jail until he could be transferred to a treatment facility to begin fulfilling his first probationary condition. The district court had statutory authority to enter such an order. We vacate the court of appeals decision to the contrary. We affirm the district court’s judgment of conviction and sentence.
DECISION OF COURT OF APPEALS VACATED; DISTRICT COURT JUDGMENT AFFIRMED.
