Judgment, Supreme Court, New York County (Franklin R. Weissberg, J.), rendered July 5, 1988, convicting defendant, upon a jury verdict, of criminal sale of a controlled substance in the third degree and sentencing him to an indeterminate term of imprisonment of from 6 to 12 years, unanimously affirmed.
Defendant and a co-defendant were indicted for the crime of criminal sale of a controlled substance in the third degree. At the Sandoval hearing (People v Sandoval, 34 NY2d 371) conducted before trial, the court reviewed defendant’s criminal record which included felony convictions of criminal possession of a controlled substance in the third degree and attempted criminal sale of a controlled substance in the third degree. Defendant had also been convicted of four misdemeanors, for burglary and theft related offenses. Before the court ruled on the Sandoval motion, the prosecutor indicated her intention to make a Molineux motion (People v Molineux, 168 NY 264) after defendant testified on direct examination. The court, however, directed the prosecutor to make the motion prior to trial so that defendant would know what he would be "facing” should he choose to testify at trial. The prosecutor then responded that if defendant denied any intention to sell drugs, "it would be unfair for the jury not to know that he has done the exact same thing, with the exact same intent, before.” The court ruled that should defendant take the stand, the prosecutor would only be allowed to elicit the fact that defendant had previously been convicted of a felony and several misdemeanors.
On direct examination, defendant testified that after the two undercover officers approached him and told him that they wanted to buy drugs, he directed them to a woman who sold drugs with the hope that the men would give him a tip. *350At the conclusion of defendant’s direct testimony, the prosecutor renewed her motion to explore defendant’s criminal record since defendant’s testimony raised an agency defense. The court ruled that since the agency defense was raised by defendant, the prosecutor was entitled to question him about his prior convictions of drug related offenses. Based on this ruling, the prosecutor extensively cross-examined defendant about his involvement with drugs.
Defendant’s contention that he was denied a fair trial by the court’s mid-trial reversal of its earlier ruling precluding cross-examination on the underlying facts of his convictions is without merit. While defendant claims he decided to testify in reliance on the court’s original ruling, it was only after he testified that the court became aware of his intention to raise an agency defense thereby triggering the court’s determination to admit the evidence of prior crimes in order to allow the jury to consider whether defendant was a seller or "merely a purchaser doing a favor for a friend” (People v Lam Lek Chong, 45 NY2d 64, 74, cert denied 439 US 935; and see, People v Ingram, 71 NY2d 474; People v Alvino, 71 NY2d 233; People v Ward, 166 AD2d 156; cf., People v Powe, 146 AD2d 718, lv denied 73 NY2d 1020; People v Sanchez, 154 AD2d 15). After defendant placed his intent in issue, proof of other crimes was admissible under the intent exception to the Molineux rule (People v Ingram, supra; People v Alvino, supra; People v Molineux, supra; People v Marin, 157 AD2d 521, lv denied 75 NY2d 968).
Nor does the record support defendant’s further contention that the trial court failed to balance the probative value of such evidence against its potential for prejudice to defendant. Important in the weighing process is how the evidence comes into the case, whether offered on the People’s direct case or in rebuttal to evidence offered by a defendant (People v Ventimiglia, 52 NY2d 350). Evidence of uncharged criminal or immoral conduct may be admitted as part of the People’s case on rebuttal if it has a tendency to disprove a defense raised by defendant (see, People v Tas, 51 NY2d 915; People v Santarelli, 49 NY2d 241, rearg denied 49 NY2d 918). In the instant case, the evidence was properly admitted to rebut defendant’s agency defense. Concur—Ross, J. P., Rosenberger, Kassal, Ellerin and Rubin, JJ.