
339 N.W.2d 263 (1983)
Michael ESCOBEDO, Petitioner,
v.
The Honorable Allen OLEISKY, Judge of District Court, Respondent.
No. C1-83-1284.
Supreme Court of Minnesota.
October 19, 1983.
William J. Gatton, Minneapolis, for petitioner.
Thomas L. Johnson, Hennepin County Atty., Vernon E. Bergstrom, Chief, Appellate Section, Minneapolis, for respondent.
Considered and decided by the court en banc without oral argument.
AMDAHL, Chief Justice.
This is a petition for a writ of mandamus. Petitioner is a juvenile who was certified for prosecution as an adult on charges of criminal damage to property and trespass to a motor vehicle. Petitioner pleaded guilty to the charges and was sentenced by the trial court to consecutive jail terms of 90 days for each offense. The trial court refused to give petitioner credit for time spent in the juvenile detention center awaiting certification for prosecution as an adult. Minn.R.Crim.P. 27.03, subd. 4(b), provides credit for "all time spent in custody in connection with the offense or behavioral incident for which sentence is imposed * * *." Petitioner has provided us with cases from two other jurisdictions holding that credit should be given in such a situation. State v. DaFonseca, 109 R.I. 414, 286 A.2d 592 (1972); People v. Thomas, 58 Mich.App. 9, 226 N.W.2d 734 (1975). The state has failed to provide us with an adequate reason why the Minnesota rule should not be interpreted similarly. We hold that the trial court erred in refusing to give petitioner credit for time spent in the detention center awaiting certification.
Remanded.
