
816 P.2d 998 (1991)
120 Idaho 441
STATE of Idaho, Plaintiff-Respondent,
v.
David Ross DORR, Defendant-Appellant.
STATE of Idaho, Plaintiff-Respondent,
v.
Edward Wade HAWLEY, Defendant-Appellant.
Nos. 18162, 18165.
Court of Appeals of Idaho.
July 1, 1991.
Petition for Review Denied October 3, 1991.
*999 Lempesis & Kroeger, Post Falls, for defendants-appellants. Mark Vovos of Spokane, Wash., and Charles B. Lempesis, Boise, argued.
Larry J. EchoHawk, Atty. Gen., Michael A. Henderson, Deputy Atty. Gen., (argued), Boise, for plaintiff-respondent.
SILAK, Judge.
These are consolidated appeals by David Ross Dorr and Edward Wade Hawley from orders of the district court denying their motions, pursuant to Idaho Code § 18-309, for credit for time served prior to sentencing. A part of the time served was in the custody of federal authorities while awaiting disposition of federal charges and/or while serving time on federal sentences. Another part of the time served was in the temporary custody of Kootenai County, pursuant to the Interstate Agreement on Detainers, I.C. § 19-5001, et seq., while awaiting disposition of state charges and simultaneously serving time on federal sentences. For the reasons stated below, we affirm.
The events leading to these criminal charges resulted from the appellants' involvement with a group known as The Bruder Schweigen, or The Silent Brotherhood, a splinter organization of the white supremacist group known as the "Aryan Nations." The Bruder Schweigen and the Bruder Schweigen Strike Force II carried on a variety of illegal activities, including bank robbery and counterfeiting, to raise money to further their cause. Dorr and Hawley constructed several pipe bombs which they exploded in Coeur d'Alene, Idaho, in September, 1986. The bombings were meant to be a diversion for their planned robberies of two banks and the National Guard armory. When an unexpectedly large number of law enforcement officers responded to the bombings, Dorr and Hawley aborted their robbery plans.
On October 2, 1986, Idaho law enforcement officers assisted special agents of the United States Secret Service and the federal Bureau of Alcohol, Tobacco and Firearms in the execution of a federal search warrant authorizing a search of Dorr's residence. Hawley and his wife, who were friends of the Dorrs, were house guests. Federal agents arrested both appellants on October 2, 1986, and they were charged in the United States District Court for the Eastern District of Washington with various counterfeiting violations. On October 8, 1986, a Kootenai County magistrate issued arrest warrants for the appellants on state charges arising from the September, 1986, bombings.
The appellants later pled guilty to federal counterfeiting conspiracy charges in the United States District Court for the Eastern District of Washington. Hawley was sentenced on April 14, 1987, and transferred to a federal prison in Tucson, Arizona. Dorr was sentenced on May 1, 1987, and remained in custody at the Spokane County Jail.
In September, 1987, pursuant to the Interstate Agreement on Detainers, Dorr and Hawley were returned to Kootenai County, and placed in the temporary custody of the state, to answer to the state bombing charges. In February, 1988, the United States Marshal's office sent detainers to Kootenai County requesting that the appellants be detained pending trial on federal charges in the United States District Court for the District of Idaho.[1]
*1000 On April 7, 1989, three days before their scheduled trial on the state charges in Kootenai County, Dorr and Hawley each pled guilty to three counts of explosion of a building. I.C. § 18-7006 (1972). A corrected judgment was entered on April 25, 1989, sentencing each of them to the custody of the Idaho Board of Correction for five-year determinate terms on each of the three counts. The sentence on each count was concurrent with the sentences imposed on the other two counts, and with the sentences imposed in both the Idaho and Washington federal court proceedings.
The district court reserved its ruling on the amount of credit for time served, if any, to which Dorr and Hawley would be entitled under Idaho Code § 18-309. After a hearing, the district court entered an order denying their motions for credit for the time they served prior to sentencing. They appeal from this order, arguing that they should have been given credit on their sentences for all of the time they served from October 2, 1986, until they were sentenced in the state court. In the alternative, they argue that they should have been given credit at least for the time they served in the custody of the State of Idaho prior to sentencing.
A sentencing court is required to give credit to a defendant for time served prior to entry of judgment, if the time served was for the offense or an included offense for which the judgment was entered. Law v. Rasmussen, 104 Idaho 455, 457, 660 P.2d 67, 69 (1983); I.C. § 18-309. The Idaho statute requiring that defendants be given credit for time served, I.C. § 18-309,
pertains to the pretrial incarceration of a person charged with crime but not yet tried much less convicted, and therefore clothed with the presumption of innocence... . The crucial element of the statute is not where or under what conditions the defendant has been deprived of his liberty but rather whether the custody to which he has been subjected `is attributable to charges arising from the same criminal act or acts for which the defendant has been convicted.'
There is no reason in law or logic to extend the protection intended to be afforded one merely charged with a crime to one already incarcerated and serving his sentence for a first offense who is then charged with a second crime. As to the latter individual the deprivation of liberty for which he seeks credit cannot be attributed to the second offense. [The statute] does not authorize credit where the pending proceeding has no effect whatever upon a defendant's liberty.
State v. Moliga, 113 Idaho 672, 675, 747 P.2d 81, 84 (Ct.App. 1987) (citations omitted; emphases in original), quoting In re Rojas, 23 Cal.3d 152, 151 Cal. Rptr. 649, 652, 588 P.2d 789, 792 (1979). The purpose of such statutes is to eliminate unequal treatment of indigent prisoners who, because they are unable to post bail, are confined longer than their wealthier counterparts. Rojas at 651, 588 P.2d at 791.
If the time they served was not attributable to the state bombing charges, Dorr and Hawley were not entitled to credit on their state sentences for the time they served prior to sentencing. State v. Beer, 97 Idaho 684, 685, 551 P.2d 971, 972 (1976); State v. Hale, 116 Idaho 763, 765, 779 P.2d 438, 440 (Ct.App. 1989). In addition, any time served in the custody of another jurisdiction on a different offense does not count toward the sentences imposed for the state bombing charges. Moliga, 113 Idaho at 676, 747 P.2d at 85; State v. Teal, 105 Idaho 501, 504, 670 P.2d 908, 911 (Ct.App. 1983).
Whether the district court properly applied Idaho Code § 18-309 to the facts in these cases involves a question of law. While this Court will defer to findings of fact based on substantial evidence, we freely review statements of law and the lower court's application of the law to the facts found. Staggie v. Idaho Falls Consolidated *1001 Hospitals, 110 Idaho 349, 351, 715 P.2d 1019, 1021 (Ct.App. 1986).
The district court found that although Dorr and Hawley were restrained by state law enforcement officers on October 2, 1986, that restraint amounted to no more than a temporary detention while federal law enforcement officers executed the federal search warrant. The district court also found that on October 2, 1986, Dorr and Hawley were arrested solely by federal officers for violations of federal law and that the federal violations were "thoroughly unrelated" to the state bombing charges. There is substantial evidence in the record before us to support these findings.
Clearly, Dorr and Hawley are not entitled to credit on their state sentences for the time they spent in the custody of federal authorities awaiting disposition of unrelated federal charges. Nor are they entitled to credit on their state sentences for the time they served on the federal sentences while in the custody of federal authorities. The issue that remains, then, is whether they are entitled to credit on their state sentences for the time they served in the temporary custody of Kootenai County while awaiting disposition of the state charges.
Dorr and Hawley contend that two prior decisions of this Court support their argument that they should have been given credit for the time they served in Kootenai County from September, 1987, when they were returned to Idaho, until they were sentenced on the state bombing charges. See Moliga, supra; Teal, supra. In both of those cases, the defendants were returned to Idaho on detainers to answer to charges pending here.
Teal was sentenced originally in Idaho on charges of burglary and forgery and was given credit for 161 days served prior to sentencing. After being placed on probation, he absconded and eventually went to California where he was arrested, and later sentenced to prison, on charges unrelated to the Idaho charges. He was then returned to Idaho from California on a detainer to answer to a probation violation charge. On appeal, we concluded that,
Teal was given credit for 161 days spent in Idaho custody under I.C. § 18-309 on the forgery charge only. Now Teal contends that, in addition to the time he actually spent in custody in Idaho, he should be given credit against his Idaho sentences for all the time elapsed since he was arrested and confined in California. However, Teal's arrest and confinement in California, before he was delivered to the Idaho authorities, had nothing to do with the Idaho convictions. Therefore, Teal is not entitled to credit for any time spent in California custody, other than the concurrent operation of the Idaho and California sentences after his probation was revoked in Idaho on May 3, 1982.
Teal, 105 Idaho at 504, 670 P.2d at 911. The credit Teal received was the 161 days he spent in jail in Idaho following his arrest on the forgery count, before he was sentenced on that count. However, he received no credit for the time he was incarcerated subsequently in California on other crimes while awaiting his return to Idaho to face probation violation charges. Thus, Teal does not support the appellants' argument here.
Moliga was returned from the state of Washington, where he was serving time in prison on charges in that state, to answer to a charge of grand theft in Nez Perce County, Idaho. He pled guilty to the Idaho charge, and the district court gave him credit on his Idaho sentence for the time he served in this state prior to sentencing. On appeal, we noted that in Teal, supra, the district court gave the appellant credit for 161 days served in Idaho, and we stated that "the district court properly allowed credit only for time served in confinement related to the Idaho charges." Moliga, 113 Idaho at 676, 747 P.2d at 85. However, credit for time served after Moliga's return to Idaho was not an issue in that case. The only issue on appeal was whether the district court erred in not allowing further credit for the time Moliga had served in Washington before his return to Idaho. Moliga, 113 Idaho at 673, 747 P.2d at 82.
*1002 To the extent that there appears to be some confusion about our holding in Moliga, supra, we take this opportunity to clarify our statements in that case. As noted, Moliga's time served in Idaho prior to sentencing on the Idaho charge was not an issue in that case. The quoted statement from Moliga, supra, properly should be interpreted as a holding that the district court did not err by denying credit to Moliga for time served in Washington on the Washington charges.
The district court here did not err by concluding that, during the time Dorr and Hawley were placed in the temporary custody of Kootenai County, they clearly remained federal prisoners serving time imposed by federal courts on federal charges, and that they were not entitled to credit on their state sentences for time served prior to sentencing. This conclusion is bolstered by the appellants' statement in their plea agreement, I.C.R. 11(d)(1)(C), that they "stipulate and agree" that
[e]ach of the Defendants is presently in the custody of the United States of America having been convicted of certain crimes in the United States District Courts in and for the Districts of Eastern Washington and Idaho.
The district court's conclusion is also consistent with the Interstate Agreement on Detainers which provides that, during the time a prisoner is in the temporary custody of the receiving jurisdiction, the sentence in the sending jurisdiction continues to run. I.C. § 19-5001(e)(6).
During the time they served in the temporary custody of Kootenai County, Dorr and Hawley were not denied their liberty because of the pending state bombing charges. Although they were awaiting disposition of those charges, their liberty already had been denied by the federal courts by virtue of the federal sentences imposed on them.
As we stated above, the purpose of Idaho Code § 18-309 is to mitigate the inequities that can result because some prisoners can afford bail while others cannot. Dorr and Hawley could not have been admitted to bail because they were federal prisoners serving federal sentences during the time they were in the temporary custody of Kootenai County. They were not entitled to credit on their state sentences for the time they served in the temporary custody of Kootenai County, nor were they entitled to credit on their state sentences for time served in the custody of federal authorities while awaiting disposition of the federal charges or while serving federal sentences.
The order of the district court denying appellants' motions for credit for time served prior to sentencing is affirmed.
WALTERS, C.J., and SWANSTROM, J., concur.
NOTES
[1]  On February 16, 1988, the United States District Court for the District of Idaho issued arrest warrants for Dorr and Hawley who were charged with a variety of federal offenses including RICO violations, malicious damage to property by explosives, various firearms violations, and attempted bank robbery. Both later pled guilty to some of the charges, although the record does not indicate the nature of the disposition of all of the charges against Dorr.

Hawley pled guilty to three of the sixteen counts with which he was charged. Judgment was entered against him on October 26, 1988, imposing concurrent sentences on those three counts. The sentences also were to run concurrently with the sentences previously imposed in the United States District Court for the Eastern District of Washington. In addition, he was given credit for time served from October 2, 1986, the date he and Dorr were arrested in Coeur d'Alene.
