
681 N.W.2d 30 (2004)
STATE of Minnesota, Respondent (A03-739), Appellant (A03-1002),
v.
Henok HADGU, Appellant (A03-739), Respondent (A03-1002).
Nos. A03-739, A03-1002.
Court of Appeals of Minnesota.
June 15, 2004.
*31 Mike Hatch, Attorney General, St. Paul, MN; and Greg Widseth, Polk County Attorney, Scott A. Buhler, Assistant County Attorney, Crookston, MN, for State of Minnesota.
John M. Stuart, State Public Defender, Marie Wolf, Assistant Public Defender, Minneapolis, MN, for Henok Hadgu.
*32 Considered and decided by LANSING, Presiding Judge, TOUSSAINT, Chief Judge, and CRIPPEN, Judge.

OPINION
CRIPPEN, Judge.[*]
This proceeding is a consolidation of appeals by both parties regarding Henok Hadgu's fifth-degree controlled substance conviction, for which the imposition of his sentence was stayed for up to five years on conditions that included serving 90 days local incarceration. The primary issue in these appeals arises out of the state's argument that the trial court erred in granting Hadgu credit for the time he spent in the custody of the United States Immigration and Naturalization Service (INS). Because we conclude that Hadgu was entitled to credit for the time he spent in the custody of the INS, we affirm. We also affirm on issues Hadgu raises, because the trial court did not abuse its discretion in admitting the evidence found in his room at the time of his arrest and because the evidence is sufficient to allow the jury to reach its verdict.

FACTS
In January 2003 a jury found Henok Hadgu guilty of a fifth-degree controlled substance crime. Before sentencing, Hadgu posted bail and thereafter the INS took him into custody and placed him in a jail in Sherburne County, where he was held from January 29 through February 11, 2003. On March 18, 2003, the trial court stayed imposition of Hadgu's sentence and ordered him to serve 90 days. Shortly thereafter, Hadgu sent the trial court a letter asking for jail credit for the time spent in INS custody. After first denying the request, the trial court granted jail credit when the motion was renewed by Hadgu's public defender. Hadgu challenges the judgment of conviction, and this appeal was consolidated with the state's appeal from the order granting Hadgu jail credit for the time he spent in INS custody.

ISSUES
1. Is Hadgu entitled to jail credit for the time spent in INS custody?
2. Did the trial court err in admitting evidence discovered at the time Hadgu was arrested?
3. Did the jury err in convicting Hadgu without sufficient evidence?

ANALYSIS

1.
The state argues that the prosecution had no control over the actions of the INS and contends it is not unfair to require Hadgu to serve both the criminal sentence and the time in INS custody on charges that he violated federal immigration laws. When granting jail credit on the time Hadgu was held by the INS, the trial court noted that this time was "a direct result of his conviction" and that if Hadgu had not posted bail, he would have remained incarcerated locally and received jail credit for this time when he was sentenced.
The decision to grant jail credit is not discretionary with the trial court. State v. Doyle, 386 N.W.2d 352, 354 (Minn. App.1986). The general intra-jurisdictional rule is that a defendant is entitled to jail credit for all time spent in custody between his arrest on the charge in proceedings in which credit is sought and his *33 sentencing for that offense. State v. Goar, 453 N.W.2d 28, 29-30 (Minn.1990). If time is spent in custody of another jurisdiction, the test is whether the jail time was spent "solely" in connection with the Minnesota offense. State v. Brown, 348 N.W.2d 743, 748 (Minn.1984). And the test for time spent in custody of Minnesota focuses on principles of fairness and equity, with regard for whether the denial of credit would result in a de facto consecutive sentence or would make the total time served turn on irrelevancies or matters subject to manipulation by the prosecutor. See Asfaha v. State, 665 N.W.2d 523, 527-28 (Minn.2003); Goar, 453 N.W.2d at 29.
The issue of jail credit for time spent in INS custody appears to be an issue of first impression. Federal immigration law permits the detention of deportable aliens who are on presentence release. 8 U.S.C. § 1226(c)(l) (2000). INS detention is intended to prevent deportable aliens convicted of a crime "from fleeing prior to or during their removal proceedings." Demore v. Hyung Joon Kim, 538 U.S. 510, 528, 123 S.Ct. 1708, 1720, 155 L.Ed.2d 724 (2003). The INS does not impose detention for criminal or punitive purposes, as do other jurisdictions holding Minnesota defendants on their own criminal charges. Here, Hadgu's INS custody time does not meet the "solely"-in-connection test because that time was not spent "solely" in connection with his Minnesota offense but serves the separate, non-penal purposes of the INS. In addition, Hadgu's INS custody time does not meet the fairness-and-equity test, because that time was not served for the punitive purposes of criminal prosecution. The underlying concerns of the fairness-and-equity test, such as de facto consecutive sentencing and prosecutorial manipulation, are not present.
But the more basic test for jail-credit awards under the criminal rules has remained whether the time was served "in connection with" the offense on which the jail credit is sought. Minn. R.Crim. P. 27.03, subd. 4(B). We conclude that this underlying test applies to INS custody situations. The trial court correctly noted that the time Hadgu spent in INS custody was "a direct result of his conviction" and if he had not posted bail "he would have remained at the Northwest Regional Correctional Center and received jail credit for this time at sentencing." Hadgu's INS custody time was served "in connection with" his Minnesota offense, and because of this the trial court correctly determined that he was entitled to jail credit for the time spent in INS custody. Our holding is consistent with those of other courts that have considered this issue and allowed a defendant to receive credit for the time the defendant spent in INS custody. See United States v. Ogbondah, 16 F.3d 498, 500-01 (2nd Cir.1994) (allowing credit against sentence for time spent technically on bail but actually in custody of INS).

2.
Hadgu argues that the trial court erred in admitting the evidence found in his room at the time of his arrest. "Evidentiary rulings rest within the sound discretion of the trial court and will not be reversed absent a clear abuse of discretion." State v. Amos, 658 N.W.2d 201, 203 (Minn.2003).
The trial court did not abuse its discretion in admitting the evidence found in Hadgu's room at the time of his arrest. Crookston police detective Gerardo Moreno set up a controlled buy with Charles Owens. Moreno gave Owens $150 in pre-recorded buy-money and equipped him with an electronic transmitter to tape the transaction. At trial, Owens testified he went to Hadgu's dormitory room where Hadgu weighed out marijuana on a small *34 hand-held scale and sold it to Owens for $130. The tape of the transaction was inaudible. Moreno went back to Hadgu's dormitory room over four months later and arrested him on a warrant; Hadgu consented to a search of his room. At the time of Hadgu's arrest, Moreno discovered the same controlled substance and a small hand-held scale in the exact same location where the charged sale of marijuana occurred.
The trial court correctly noted that these items were found in the same place as described in Owens' testimony, and that the evidence, which is in the nature of Spriegl evidence, "goes to the issues of both identity [of Hadgu] and corroboration of the testimony of [Owens]." Furthermore, the trial court gave a limiting instruction prior to the admission of the evidence and again as part of the final jury instructions, instructions that "lessened the probability of undue weight being given by the jury to the evidence." See State v. Kennedy, 585 N.W.2d 385, 392 (Minn. 1998). The court did not abuse its discretion in admitting the evidence found in Hadgu's room at the time of his arrest.

3.
Hadgu also contends that the evidence was insufficient for the jury to find him guilty of fifth-degree controlled substance crime. In considering this claim, our review is limited to a painstaking analysis of the record to determine whether the evidence, when viewed in the light most favorable to the conviction, was sufficient to allow the fact finder to reach its verdict. State v. Webb, 440 N.W.2d 426, 430 (Minn. 1989). We must assume the jury believed the states witnesses and disbelieved any evidence to the contrary. State v. Moore, 438 N.W.2d 101, 108 (Minn.1989). The verdict must be affirmed if the fact-finder, acting with respect for the principles of presumed innocence and proof beyond a reasonable doubt, could have reasonably found as it did. State v. Alton, 432 N.W.2d 754, 756 (Minn.1988).
The evidence, viewed in the light most favorable to the conviction, is sufficient to allow the jury to convict. Owens testified that Hadgu weighed out marijuana on a small hand-held scale and Owens gave him $130 in exchange for the marijuana. "It is well established that a conviction can rest upon the testimony of a single credible witness." State v. Bliss, 457 N.W.2d 385, 390 (Minn.1990); see also State v. Hill, 285 Minn. 518, 518, 172 N.W.2d 406, 407 (1969) ("[A] conviction can rest on the uncorroborated testimony of a single credible witness."). Although Hadgu contends that Owens' reliability is questionable, that credibility was attacked on cross-examination, and it is the "exclusive function of the jury" to judge the credibility of witnesses. Dale v. State, 535 N.W.2d 619, 623 (Minn.1995). The jury convicted Hadgu despite attacks on Owens' credibility, and this court must assume the jury believed Owens. Moore, 438 N.W.2d at 108.
Hadgu also contends the police failed to use available means to verify and corroborate Owens' testimony. But there is no requirement that the state corroborate Owens' testimony because he was not an accomplice to Hadgu. See State v. Swyningan, 304 Minn. 552, 556, 229 N.W.2d 29, 32 (1975) (holding that a person who obtains drugs from a seller is not an accomplice of the seller). There is merit in Hadgu's contention that this record should be closely scrutinized, and it is significant that the evidence found in his room at the time of his arrest corroborates the testimony that Hadgu is the person who sold Owens the marijuana, that the controlled buy took place in Hadgu's room, and that Hadgu weighed the marijuana on a small hand-held scale before selling it.
*35 Our survey of the record shows the evidence is sufficient to bring the matter within the prerogative of the jury to determine Hadgu's guilt beyond a reasonable doubt. Because the evidence, viewed in the light most favorable to the conviction, is sufficient to allow the jury to reach its decision, we affirm.

DECISION
The trial court did not err in granting Hadgu credit for the time he spent in INS custody because Hadgu's INS custody time was time served "in connection with" his Minnesota offense. We affirm on issues raised by Hadgu because the trial court did not abuse its discretion in admitting the evidence found in his room at the time of his arrest, and because the evidence is sufficient to permit the conviction.
Affirmed.
NOTES
[*]  Retired judge of the Minnesota Court of Appeals, serving by appointment pursuant to Minn. Const. art. VI, § 10.
