The only question in this case is whether Randy Lightly is entitled to credit against the maximum sentence imposed by the district court for time spent in the Carbon County Jail prior to the imposition of sentence. The district court specifically did not allow credit against the maximum sentence for the time that Lightly was confined prior to sentence. The propriety of the district court's sentence depends upon whether Lightly was in state custody рending the disposition of the charges against *1233 him or was held as a federal prisoner. Whatever the likelihood is that the district court was justified in its belief that Lightly was a federal prisoner, the record does not reflеct that fact. On this record, under the law, the credit for pre-sentence confinement must be granted. We reverse the denial by the district court of Lightly’s motion for correction of sentence and mandate thаt the sentence be modified by the credit of 85 days against the maximum sentence.
In his brief, Lightly states one issue: “Whether the trial court abused its discretion in refusing to give credit against appellant’s sentence for time served in pre-sentence confinement.”
In the Brief of Appellee, filed on behalf of the State, the issue is defined in this way:
“Whether the trial court abused its discretion in refusing to give appellant credit for time servеd in pre-sentence confinement, against either his minimum or maximum sentence?”
On July 31,1983, Lightly was arrested in Carbon County. A complaint and criminal warrant reflect that he was charged with intentionally placing a victim in fear of immediate bodily injury while committing a larceny in violation of §§ 6-2-401 and 6-3-402, W.S.1977, and a second count of stealing and carrying away the victim’s automobile in violation of § 6-3-402(c)(i), W.S. 1977. Prior to the events which led to his arrest, Lightly was being transported from a federal penitentiary in California to a federal penitentiary at Leavenworth, Kansas. While in temporary confinement in the Albany County jail at Laramie, he escaped. He made his way to Rаwlins and there accosted a couple from Washington who were near their car in a motel parking lot. Lightly demanded that they give him their money and their ear and manifested to them that he was conceаling a weapon. The people from Washington, fearing for their safety, complied with Lightly’s demands, and he then fled in the stolen car. He was apprehended on the interstate highway west of Rawlins.
Following a prеliminary examination,. Lightly was bound over to the district court to answer one charge of robbery and one charge of larceny. When he was arraigned in the district court, he indicated that he believed he sufferеd from a mental illness. In accordance with the statute (§ 7-11-303, W.S.1977), the court ordered an examination which was conducted at the jail in Carbon County. The findings of the examiner were negative with respect to any mental illness or deficiency at the time of the commission of the crime or at the time of the proceedings. The examiner also reported that Lightly was competent to proceed. At a subsequent court appearance, Lightly then entered a plea of guilty to the robbery charge, and the State agreed to drop the larceny charge and not file any other charges in connection with the incident. Lightly then was sentenced to a term of not less than seven nor more than ten years in the state penitentiary, with no credit for his pre-sentence confinement against either the maximum or minimum sentence. About twо and three-fourth years later, Lightly filed a pro se motion pursuant to Rule 36, W.R.Cr.P., attacking the legality of his sentence and requesting that he be given credit for his pre-sentence confinement. The motion was timely beсause a motion to correct an illegal sentence may be brought at any time. Rule 36, W.R.Cr.P. Lightly’s motion was denied by the district court, and this appeal then was taken.
Recently, in
Harley v. State,
Wyo.,
“ * * * [A] trial judge has discretion to deny or grant credit for time served in pre-sentence custody where: (1) the pre-sentеnce custody is not due to the defendant’s indigency, and (2) the sum of the time spent in pre-sentence custody plus the sentence does not exceed the maximum allowable sentence.” 1
*1234 If Lightly was in custody because of his indigency or if the sum of his time in pre-sentence confinement plus the sentence exceeds the maximum allowable term, he is entitled to relief. On this record, both of those things occurred.
The State concedes that the maximum sentence which was imposed and the pre-sentence confinement exceed the maximum statutory punishment for the offense. The State attempts to distinguish Jones v. State, supra, however, contending that Lightly was not confined because of his indigency but would have been maintained in custody as a federal prisoner even if he had posted bond. The State relies upon his status as a federal prisoner. The аssumption is that the federal authorities had requested that Lightly be returned to federal custody when the state proceedings had been completed. The record does not support that assumption. It is true, аs the State argues, that Lightly testified about his federal confinement and his escape therefrom at Laramie. Beyond his testimony, there is nothing in this record to indicate that while confined in the Carbon County jail he was being held as a federal prisoner. The tenor of the record is contrary and demonstrates only that he was being held in state custody pursuant to the charges upon which he was convicted. There is nothing to indicate that, absent a status of indigency, he could not have been released upon bail. Recognizing a high probability that he would have remained in custody as a federal prisoner, we still must resolve the casе on the basis of the record. So far as this record is concerned, the pre-sentence confinement for Lightly was due to the pending state charges.
In Harley v. State, supra, we held that the critical factor in determining indi-gency for purpose of crediting pre-sentence confinement is the ability of the defendant to post bond. If the confinement is not attributable to an inability to post bond, the equal protection and due рrocess clauses of the Fourteenth Amendment to the United States Constitution are not implicated. This record demonstrates that Lightly’s bond was set at $25,000. There is nothing to indicate that he had the financial resourcеs to post this bond. Had he been able to do so, he well might have obtained his freedom from Wyoming authorities pending disposition and sentencing. Furthermore, he did file an affidavit of indi-gency, and the public defender was аppointed to represent him. The circumstances demonstrated by the record reflect that Lightly was indigent for purposes of entitlement to credit for his pre-sentence confinement.
As the State concedes, the second prong of the test in Jones v. State, supra, also is invоked if Lightly was in state custody. Because the record does not refute the proposition that Lightly was in custody only because of the pending state charges, the law does not permit him to be sentenced to the maximum term under the statute, which he was, without affording him credit for the time in pre-sentence confinement. Unless that result flows, Lightly ultimately serves, or potentially could serve, more than the maximum term authorized by the legislаture. This circumstance also justifies Lightly’s credit for the 85 days in pre-sentence confinement.
We are cognizant of the fact that part of the pre-sentence confinement in this case was attributable tо the necessity for determining mental competency. The parties did not address this issue, and we have had no occasion previously to decide whether credit should be given for incarceration which wаs made necessary because of a claim of mental incompetency. Other courts have concluded, in the light of their statutes, that credit is appropriate if the determination of compеtency is necessary in order to dispose of the same crime upon which the defendant is awaiting trial.
McNeely v. Henry,
App.,
In this case, there is no indication that Lightly could not have been examined as an out-patient if he had been able to post bond. Section 7-11-303, W.S.1977, Cum. Supp.1986, provides that the determination of mental competency can be made on either in-patient or out-patient basis. Furthermore, the statute provides for posting bail if the court determines the accused is competent to proceed. The indicаtion is that Lightly could not have been held in custody lawfully for purposes of the examination for mental competency if he had the ability to post bond. Under the circumstances, it makes no difference whether he was maintained in pre-sentence confinement for purposes of the mental examination or because he could not post bond.
In this instance, the record demonstrates that Lightly is entitled to a сredit against his maximum sentence for pre-sentence confinement of 85 days. He is entitled to that credit because of his indigency, because the maximum term would exceed that authorized by the legislature, and because his retention in custody for purposes of a competency examination would not justify the denial of the credit. The case must be remanded to the district court with direction that Lightly’s sentence be modified to encompass a credit of 85 days for pre-sentence confinement against the maximum 10-year sentence.
Harley v. State,
supra;
Heier v. State,
Wyo.,
Notes
. Prior applications of this test have treated it as conjunctive. E.g.,
Harley v. State,
Wyo.,
