
133 P.3d 684 (2005)
STATE of Alaska, Appellant,
v.
Gavis V. THOMAS, Appellee.
No. A-8778.
Court of Appeals of Alaska.
December 16, 2005.
Rehearing Denied March 8, 2006.
Timothy W. Terrell, Assistant Attorney General, Office of Special Prosecutions and Appeals, Anchorage, and Gregg D. Renkes and David W. Márquez, Attorneys General, Juneau, for the Appellant.
David K. Allen, Assistant Public Advocate, Fairbanks, and Joshua P. Fink, Public Advocate, Anchorage, for the Appellee.
Before: COATS, Chief Judge, and MANNHEIMER and STEWART, Judges.

OPINION
MANNHEIMER, Judge.
Gavis V. Thomas was on felony probation, and one of his conditions of probation required him to submit to searches for controlled substances. During one such search, a police officer found crack cocaine in Thomas's wallet, and this discovery led to Thomas's indictment for fourth-degree controlled substance misconduct.
Following his indictment, Thomas asked the superior court to suppress the cocaine found in his wallet. Thomas argued that even though the search was conducted within the bounds of his probation condition, the judge who sentenced him for the prior felony never should have imposed that condition of probation in the first place. Thomas noted that his prior convictions were for first-degree vehicle theft and for driving while intoxicated after consuming alcoholic beverages (not drugs). Because of this, Thomas argued that his earlier sentencing judge had lacked a proper basis for imposing a probation condition that authorized searches for controlled substances.
Superior Court Judge Charles R. Pengilly agreed with Thomas; he retroactively struck the condition of probation, and he suppressed the cocaine found in Thomas's wallet. The State now appeals the superior court's decision.
The State first argues that defendants in Thomas's position should not be allowed to attack their conditions of probation after the fact. The State asserts that a defendant who fails to challenge a condition of probation in a *685 direct appeal of the underlying conviction has no right to challenge the condition later.
The State argues in the alternative that, even if Thomas had the right to challenge his condition of probation in the current proceedings, Judge Pengilly was wrong to strike down the challenged condition of probation.
We need not decide the issue presented in the State's first argument because we agree with the State's second argument.


The meaning of the "direct relationship" test adopted by the Alaska Supreme Court in Roman v. State

In Roman v. State, 570 P.2d 1235, 1243 (Alaska 1977), the Alaska Supreme Court held that a sentencing judge should not require a probationer to submit to warrantless searches for drugs, weapons, or other types of items "unless there is a direct relationship [between those] searches [and] the nature of the crime for which the [probationer] was convicted".
The question presented in this appeal is whether the facts of Thomas's case (at the time of his original sentencing in June 2000) provided a sufficient basis for his earlier sentencing judge to impose the challenged condition of probation. But the underlying issue is how broadly or narrowly we should interpret Roman's requirement of a "direct relationship" between the authorized search and the "nature of the [defendant's] crime".
In previous cases, we have adopted a broad reading of this language. We have upheld conditions of probation that were related, not to the particular crime for which the defendant was being sentenced, but rather to the underlying causes of the defendant's criminal behavior as revealed by the defendant's history and background. Judge Pengilly was aware of our prior decisions in this area, but he concluded that our prior decisions were inconsistent with the test formulated by the supreme court in Roman, and he concluded that he was obliged to follow Roman.
Given a narrow reading, Roman's requirement of a "direct relationship" between the authorized search "and the nature of the [defendant's] crime" might reasonably be interpreted to mean that a sentencing judge could not impose a condition of probation allowing searches for drugs unless the crime for which the defendant was being sentenced involved the possession, use, or sale of drugs.
But two years after Roman, in Sprague v. State, 590 P.2d 410 (Alaska 1979), the supreme court indicated that it was employing a broader definition of "the nature of the [defendant's] crime". The defendant in Sprague was convicted of burglary, and his sentencing judge imposed a condition of probation that authorized searches for drugs.[1] The supreme court invalidated the search condition, but the court did not base its ruling on the fact that the elements of burglary do not require proof of drug possession or drug use. Instead, the court employed a broader test. The court declared that Sprague's condition of probation was invalid because (1) Sprague was not convicted of a drug offense, and (2) there was no showing that Sprague was addicted to drugs, or that he had committed the burglary in order to obtain money to buy drugs.[2]
In other words, the supreme court's explanation of its decision in Sprague demonstrates that the reference in Roman to the "nature of the [defendant's] crime" encompasses more than simply the elements of that crime. Rather, the supreme court meant to authorize conditions of probation that addressed the causes of, or the motivations for, the defendant's criminal behavior. The true test is the alternative formulation contained in the Roman opinion itself: a condition of probation must be "reasonably related to the rehabilitation of the offender and the protection of the public[,] and must not be unduly restrictive of [the offender's] liberty." Roman, 570 P.2d at 1240.
This is how we have interpreted and applied Roman. For example, in Allain v. State, 810 P.2d 1019 (Alaska App.1991), this Court upheld a probation condition that required the defendant to abstain from alcoholic beverages. We acknowledged that the *686 record "disclose[d] no direct link between [the defendant's] drinking and his current offense", but our review of the record convinced us that the sentencing judge could reasonably conclude that the defendant's chances for rehabilitation would be enhanced by the challenged condition of probation.[3]
Similarly, in Miyasato v. State, 892 P.2d 200 (Alaska App.1995), this court upheld a probation condition requiring the defendant to undergo sex offender therapy. Even though the defendant was not being sentenced for a sex crime (he was convicted of non-residential burglary), we concluded that the defendant's past record offered ample basis for the sentencing judge "to conclude that sex offender treatment was integrally related to [the defendant's] rehabilitation and to the future protection of the public."[4]
For these reasons, we conclude that Judge Pengilly adopted too narrow a reading of Roman. Even though Thomas's prior offenses were not drug offenses per se, the challenged condition of probation would be adequately grounded if, based on Thomas's record, his sentencing judge  Superior Court Judge Mark I. Wood  could reasonably have concluded that (1) Thomas had a problem with the abuse of controlled substances, and that (2) Thomas's continued abuse of controlled substances would impede his rehabilitation or would contribute to renewed criminal behavior.

Did Thomas's record at the time of his sentencing support the judge's decision to impose the challenged condition of probation?
The three pre-sentence reports on Thomas (i.e., the report prepared in 2000 for Thomas's sentencing by Judge Wood, plus two prior reports from 1997 and 1993) show that Thomas has a history of drug use. In 1992, Thomas tested positive for marijuana. In 1995 and again in 1996, he tested positive for cocaine. And in 1997, when Thomas was arrested for one of his previous DWI offenses, he was found in possession of a ball of aluminum foil containing a white powder residue.
It is true, as Thomas points out, that he has never been convicted of a drug offense. (All three of Thomas's DWI convictions were based on his consumption of alcoholic beverages.) And when Judge Wood sentenced Thomas in 2000, Thomas's last known drug use was either in May 1996 or April 1997. Nevertheless, given Thomas's history, it was reasonable for Judge Wood to conclude that a condition of probation allowing drug searches would further both Thomas's rehabilitation and the protection of the public.
For these reasons, Judge Pengilly erred when he retrospectively struck down this condition of Thomas's probation and suppressed the cocaine found in Thomas's wallet.

Conclusion
The judgement of the superior court is REVERSED. The challenged condition of probation is lawful, and the State may prosecute Thomas for possession of the cocaine found in his wallet.
NOTES
[1]  Sprague, 590 P.2d at 417.
[2]  Id. at 418.
[3]  Allain, 810 P.2d at 1022.
[4]  Miyasato, 892 P.2d at 202.
