
392 N.W.2d 134 (1986)
STATE of Iowa, Appellee,
v.
George A. KERN, Appellant.
No. 85-1417.
Supreme Court of Iowa.
August 20, 1986.
William L. Kutmus of Kutmus & Pennington, P.C., Des Moines and Lylea M.
*135 Dodson of Dreher, Wilson, Simpson, Jensen & Adams, P.C., Des Moines, for appellant.
Thomas J. Miller, Atty. Gen., Roxann M. Ryan, Asst. Atty. Gen., James A. Smith, Co. Atty., and Frederick W. Gay, Asst. Co. Atty., for appellee.
Considered by REYNOLDSON, C.J., and McGIVERIN, LARSON, SCHULTZ, and WOLLE, JJ.
REYNOLDSON, Chief Justice.
A jury found defendant George A. Kern guilty of delivering a controlled substance. See Iowa Code § 204.401(1) (1985). Trial court entered judgment on the verdict, sentenced defendant to a term of imprisonment, fined him $2500, and ordered him to complete 150 hours of community service. The court later suspended the sentence and placed defendant on two years probation. Defendant now appeals from his conviction, asserting trial court erred in admitting testimony of the State's rebuttal witness. We affirm.
I. Based on the trial evidence, a jury could have found the following facts. Defendant is a medical doctor who maintained a family practice in Des Moines, but in more recent years has focused on geriatrics medicine.
In January 1985, the Des Moines police department received information from Sue Burn that over an extended period of time defendant gave her the drug Percodan, a controlled substance, in exchange for sex. She agreed to help set up a meeting between an undercover officer and defendant.[1] Under this arrangement officer Richardson telephoned defendant and identified herself as "Roxanne." Defendant indicated he was expecting her call and asked what she wanted. Richardson responded that she wanted Percodan. Although she asked for more, Richardson accepted defendant's offer of ten Percodan tablets. Defendant then indicated he wanted to do whatever they both would enjoy. The two scheduled a later meeting to take place at defendant's home on January 24.
Richardson arrived at 9:21 p.m. on that date and entered defendant's home through a side door pursuant to his instructions. Defendant immediately fixed Richardson a drink, and in doing so, offered her an ice cube shaped like a penis. Shortly thereafter, Richardson asked defendant for the Percodan "up front" because she "had never done this type of thing before." Defendant responded by giving the officer one Percodan tablet from an unmarked bottle.[2] When Richardson pressed defendant for more tablets, he indicated he never "welched" on a deal.
Defendant and Richardson engaged in some conversation before she again asked for more Percodan. This time defendant gave her nine more tablets. Richardson did not indicate she was in any type of pain prior to requesting the tablets.
The discussion then became filled with sexual innuendos and references. Defendant again stated he wanted to do whatever they both would enjoy and found mutually satisfying. At no time during the entire evening did defendant conduct a medical examination of the officer or obtain her medical history.
Some time after 10 p.m. several Des Moines police officers knocked on defendant's door. They identified themselves and informed defendant that "Roxanne" was an undercover police officer. The officers secured the ten Percodan tablets and left with Richardson.
At trial defendant conceded he gave Richardson ten Percodan tablets. He, however, testified "Roxanne" complained of migraine headaches, and he gave her Percodan, an accepted medication for such pain, to "try to help her." Defendant thus maintained he dispensed the tablets for a legitimate *136 medical purpose and committed no crime. Medical experts on both sides testified that if a doctor dispensed Percodan when no medical complaint was made, he or she would not be prescribing such medication for a legitimate medical purpose.
On cross-examination by the State, defendant indicated he had never dispensed Percodan out of his home without a legitimate medical purpose. The State then made an offer of proof that for approximately two years witness Sue Burn engaged in sex with defendant at his home in exchange for varying quantities of Percodan. Defendant objected, asserting the testimony was irrelevant and improper for impeachment because it related to collateral issues. Trial court overruled the objection and permitted Burn to testify.
On appeal defendant contends trial court erred in admitting this testimony. We reject the State's assertion that defendant failed to preserve error and proceed to address the merits.
II. In its offer of proof the State noted it was relying on several different grounds for admission of the evidence, including Iowa Rule of Evidence 404(b) and impeachment. During a later exchange between counsel and the court, it became unclear whether the State actually intended to rely on rule 404(b). Trial court admitted the evidence, but initially indicated the State was not relying on rule 404(b). Before the evidence was presented to the jury, however, trial court clarified its ruling by stating that rule 404(b) was a basis for its decision to admit the testimony and the State properly urged admission on this ground. The court later indicated the evidence was relevant to intent and its probative value outweighed the danger of prejudice. Defendant now argues the State cannot rely on rule 404(b) as a basis for admission of the evidence. He asserts the only issue before us is whether the evidence was admissible for impeachment.
We believe trial court made clear its ruling was based in part on rule 404(b). Moreover, "we will uphold a ruling of the court on the admissibility of evidence on any ground appearing in the record, whether urged below or not." State v. McCowen, 297 N.W.2d 226, 227 (Iowa 1980); see State v. Jespersen, 360 N.W.2d 804, 806 (Iowa 1985) ("[T]rial court's ruling ... resulting in admission of the evidence will be upheld if it is sustainable on any grounds appearing in the record."). We are not required to adopt trial court's reasoning to sustain its conclusion. McCowen, 297 N.W.2d at 227. Thus, we consider whether the testimony of witness Burn was admissible under rule 404(b).
The rule provides:
Evidence of other crimes, wrongs, or acts is not admissible to prove the character of a person in order to show that he acted in conformity therewith. It may, however, be admissible for other purposes, such as proof of motive, opportunity, intent, preparation, plan, knowledge, identity, or absence of mistake or accident.

Iowa R.Evid. 404(b) (emphasis added).
Evidence offered under rule 404(b) must be probative of a matter involved in the case. The key is relevancy. State v. Emerson, 375 N.W.2d 256, 260 (Iowa 1985). Thus, we previously have indicated that evidence of a defendant's prior acts is inadmissible when it is offered to show only that defendant is a bad person. State v. Spargo, 364 N.W.2d 203, 208 & n. 3 (Iowa 1985) (Rule 404(b) was not in effect at the relevant times in Spargo. The court, however, indicated the general principles are the same under rule 404(b) as under prior law.).
Once trial court concludes the evidence is relevant, it must determine whether the probative value of the evidence outweighs the danger of prejudice to defendant. Id. at 208-09. Trial court determines whether such evidence is admissible by exercising its sound discretion. Emerson, 375 N.W.2d at 260. We will not reverse such a determination unless we find a clear abuse of discretion.
*137 In the present case, intent was an element of the crime charged: delivery of a controlled substance. Defendant maintained he gave Richardson the Percodan for a legitimate medical purpose. Consequently, he asserted that no crime had been committed, even though Percodan was dispensed. Defendant's intent was clearly in issue. See United States v. Stump, 735 F.2d 273, 275 (7th Cir.), cert. denied, ___ U.S. ___, 105 S.Ct. 203, 83 L.Ed.2d 134 (1984). Moreover, the intent exception to the bar against evidence of prior acts applies "when by its nature the act [currently charged] might have been entirely innocent." State v. Belieu, 288 N.W.2d 895, 901 (Iowa 1980). The intent exception was applicable here.
The State offered the evidence of defendant's prior acts with Sue Burn to show his intent in this case. Burn's testimony indicated defendant had engaged in activities similar to those underlying the current charge. The witness testified that for a two-year period she went to defendant's house at least once a week and engaged in sexual activities with him in exchange for varying quantities of Percodan. The relationship ended after defendant's encounter with Richardson.
Evidence of similar crimes or acts is relevant to the issue of intent. State v. Thomas, 275 N.W.2d 211, 215 (Iowa 1979); see Spargo, 364 N.W.2d at 209; see also United States v. Carter, 760 F.2d 1568, 1579 (11th Cir.1985). The evidence here demonstrated that under similar circumstances defendant recently had dispensed drugs outside the scope of legitimate medical practice. The evidence therefore was relevant to the contested issue of intent and properly admissible under rule 404(b). See Stump, 735 F.2d at 275. Further, trial court did not abuse its discretion in concluding the probative value of such evidence outweighed the danger of prejudice to defendant. See id. We find no error.
The trial court's judgment is affirmed.
AFFIRMED.
NOTES
[1]  Burn met with Des Moines narcotics officers after they discovered she had falsified medical prescriptions in order to obtain Percodan. She agreed to set up a meeting between an undercover agent and defendant in exchange for the State's promise to drop any charges arising from the forged prescriptions. Pending charges against Burn were not dropped, however, because she accumulated two more drug-related charges after the initial agreement was made.
[2]  Officer Richardson never ingested any of the Percodan obtained from defendant.
