This is an application for a writ of mandate to compel the district court to credit petitioner with four months previously served in the state prison as a condition of deferment of sentence, against the sentence subsequently imposed following revocation of the deferment.
The facts are undisputed. Relator entered a plea of guilty to the crime of possession of dangerous drugs in the district court of Park County. On April 27, 1972, the district court deferred imposition of sentence on condition that relator serve four months in the state prison at Deer Lodge. Pursuant thereto, relator served four months in the state prison.
Following relator’s release from prison, the district court on January 10, 1973, revoked relator’s deferred imposition of sentence and sentenced him to a term of five years imprisonment in the state prison. The district court gave relator credit for forty days confinement in the county jail prior to sentencing, but refused to credit him with the four months he had previously served in the state prison as a condition of the original deferment of sentence.
Relator has filed a petition for writ of mandate as an original proceeding in this Court contending that section 95-2215, R.C.M. 1947, requires that he be credited with the four months previously served as a condition of deferment against the five year sentence subsequently imposed. Following issuance of an order to show cause, an adversary hearing was held.
Section 95-2215(a), R.C.M. 1947, provides in pertinent part;
“Any person incarcerated on a bailable offense and against whom a judgment of imprisonment is rendered shall be allowed credit for each day of incarceration prior to or after conviction
*100Accordingly, relator argues, lie is entitled to credit for.the four months previously served as a condition of deferment.
The state, on the other hand, contends that serving a period of time in the county jail or state prison as a condition of deferment of sentence cannot be considered a judgment of imprisonment within the meaning of the statute, or a term of imprisonment in any sense. It is simply a condition of deferment and nothing else, according to the state. The state cites State ex rel. Woodbury v. District Court, 159 Mont. 128, 495 P.2d 1119, 29 St.Rep. 250, and In re Petition of Williams, 145 Mont. 45, 399 P.2d 732, in support.
The state’s contention misses the mark. Woodbury involved the validity of imposing a thirty day jail sentence as a condition of deferment of sentence, an issue not involved in the instant case. Williams involved the power of the district court to subsequently sentence a defendant to a term in the state prison following revocation of a suspended sentence involving jail based probation, likewise not an issue in this case.
The sole issue in this case is whether the prison time previously served by relator as a condition of deferment must be credited against the prison term subsequently imposed. Relator was clearly “incarcerated on a bailable offense” under the statute when he served four months in the state prison as a condition of deferment of sentence on a plea of guilty to the crime of possession of dangerous drugs. A “judgment of imprisonment” was subsequently imposed against him following revocation of deferment. Accordingly, he “shall be allowed credit for each day of incarceration prior to or after conviction” pursuant to the statute. It is foreign to the issue in the instant case whether the four months served in the state prison is considered “a term of imprisonment” or “a judgment of imprisonment” for purposes of determining its validity as in Woodbury or in determining the validity of the prison term subsequently imposed as in Williams; it is nonetheless “incarceration, on a bailable offense” under section 95-2215(a), R.C.M. 1947, entitling relator *101to credit therefor against the prison sentence subsequently imposed.
Let an appropriate writ issue forthwith directing the district court to credit the four months served by relator in the state prison in 1972 against the sentence imposed on January 19, 1973.