
220 P.3d 504 (2009)
2009 WY 142
Nathan Hans SWAIN, Appellant (Defendant),
v.
The STATE of Wyoming, Appellee (Plaintiff).
No. S-08-0280.
Supreme Court of Wyoming.
November 19, 2009.
*505 Representing Appellant: Diane M. Lozano, Wyoming State Public Defender; Tina N. Kerin, Appellate Counsel; David E. Westling, Senior Assistant Appellate Counsel, Wyoming Public Defender Program.
Representing Appellee: Bruce A. Salzburg, Wyoming Attorney General; Terry L. Armitage, Deputy Attorney General; D. Michael Pauling, Senior Assistant Attorney General; Graham M. Smith, Assistant Attorney General.
Before VOIGT, C.J., and GOLDEN, HILL, KITE, and BURKE, JJ.
GOLDEN, Justice.
[¶ 1] Appellant Nathan Hans Swain appeals the district court's order denying him credit for time served on three separate probation revocation actions. Swain also appeals his conviction for indirect criminal contempt arising from his failure to comply with the district court's order requiring him, as a condition of probation, to attend and complete an inpatient substance abuse treatment program. For the reasons set forth below, we conclude Swain is entitled to additional credit against his sentence, and that his conviction for indirect criminal contempt cannot stand. We reverse and remand for further proceedings consistent with this opinion.

ISSUES
[¶ 2] Swain presents the following issues:
I. Did the trial court err by imposing an illegal sentence?
II. Did the trial court err by violating Appellant's due process rights by imposing contempt sanctions after improper service, failing to inform Appellant of the consequences of his plea and subjecting Appellant to double jeopardy?


*506 FACTS
[¶ 3] In January 2007, Swain pled guilty to felony battery against a household member in violation of Wyo. Stat. Ann. § 6-2-501(b) and (f)(ii) (LexisNexis 2007). He was sentenced to three to five years in prison, with credit for 275 days of presentence confinement. Execution of that sentence was suspended, and he was placed on four years of supervised probation.
[¶ 4] Between October 2007 and August 2008, the State filed three separate revocation petitions because Swain violated the terms of his probation. The first revocation petition alleged that Swain had used marijuana and absconded from supervision. Swain was arrested on October 15, 2007, and subsequently admitted the allegations contained in the petition. On January 10, 2008, the district court revoked and reinstated his probation. A condition of that probation required Swain to successfully complete the program at the Cheyenne Transitional Center.
[¶ 5] Swain never reported to the program and absconded from supervision, prompting the filing of the second probation revocation petition. He was arrested on March 20, 2008. As before, Swain admitted to violating the terms of his probation. On July 3, 2008, the district court again revoked and reinstated Swain's probation. As a condition of that probation, the district court ordered Swain to "report directly to and be placed in and successfully complete the Transitions Residential Program," an inpatient substance abuse treatment program.
[¶ 6] Swain also failed to report to that program, and the State's third revocation petition ensued. Swain was arrested on August 7, 2008. At his initial appearance on August 21, the district court advised Swain it was considering charging him with indirect criminal contempt for his alleged failure to abide by the order requiring him to attend and complete the Transitions Residential Program. On August 27, the district court issued an order to show cause in the underlying criminal case requiring Swain to appear before the court on September 4 and show cause why he should not be held in indirect criminal contempt for violating its order.
[¶ 7] At the September 4 hearing, Swain's counsel implored the district court to drop the contempt charge, but the district court declined to do so. The district court, however, continued the contempt hearing, as well as the revocation hearing, until September 18 to allow counsel additional time to prepare a defense. During the September 18 hearing, Swain admitted failing to report to the inpatient treatment program as ordered, thereby providing a factual basis for both the probation revocation and the criminal contempt charge. The district court revoked Swain's probation and reinstated the underlying three-to-five-year prison sentence, with the original presentence credit of 275 days. The district court denied credit against that sentence for the time Swain served pending resolution of the three probation revocation actions. The district court also found Swain in indirect criminal contempt and sentenced him to sixty days in jail, with credit for fourteen days served between September 4 and September 18. The district court ordered that the underlying prison sentence be served consecutively to the sixty-day contempt sentence. This appeal followed.

DISCUSSION

Sentencing Credit
[¶ 8] Swain contends his sentence is illegal because the district court did not give him credit for the time he served in the Laramie County Detention Center on the three probation revocation actions. A sentence that does not include proper credit constitutes an illegal sentence. Whether a sentence is illegal is a question of law, which we review de novo. Beyer v. State, 2008 WY 137, ¶ 7, 196 P.3d 777, 780 (Wyo.2008); Manes v. State, 2007 WY 6, ¶ 7, 150 P.3d 179, 181 (Wyo.2007).
[¶ 9] Our recent decision in Jackson v. State, 2009 WY 82, 209 P.3d 897 (Wyo.2009), governs our disposition of Swain's claim. In Jackson, we held that the time spent in custody awaiting disposition of probation revocation proceedings must be credited against the probationer's underlying sentence if the incarceration is directly attributable to the underlying criminal conviction, overruling Halbleib v. State, 7 P.3d 45 (Wyo.2000) (denying *507 credit on the grounds that pre-revocation confinement is due solely to acts or omissions constituting the violation of the conditions of probation and can never be directly attributable to the underlying offense). Jackson, ¶¶ 10-12, 209 P.3d at 900-01. In reaching this result, we stated:
[T]here are situations where the incarceration is directly attributable to the act that violates the conditions of probation rather than the underlying criminal charge. The most obvious are those situations where a defendant is arrested and charged with committing a new crime. But there are also circumstances where a defendant is alleged to have violated probation conditions by committing acts that are not otherwise criminal. For example, probationers are frequently barred from leaving a defined geographic location, drinking alcohol, contacting the victim of the underlying crime, and so on. Violating these conditions may be the direct cause of the probationer's detention, but it is indisputable that the State would be unable to incarcerate the probationer for these acts absent the conviction for the underlying crime. Under those circumstances, we are forced to conclude that pre-revocation incarceration is attributable to the underlying crime.
Id., ¶ 11, 209 P.3d at 900.
[¶ 10] We concluded in Jackson that credit was warranted because the sole reason for Mr. Jackson's detention was the allegation he violated the conditions of his probation. Mr. Jackson was not charged with a separate criminal offense as a result of the facts alleged in the petition, and the only allegation resolved in the State's favor supporting the probation revocation was that Mr. Jackson absconded from supervision. Under the specific facts of the case, we determined the time Mr. Jackson was detained pending resolution of the probation revocation proceedings was a direct result of the underlying criminal conviction, and he was entitled to credit for the time incarcerated against his minimum and maximum sentence on the underlying sentence. Id., ¶ 14, 209 P.3d at 901.
[¶ 11] In the instant case, like Jackson, the sole basis for Swain's detention in each of the revocation proceedings was the accusation he had violated one or more conditions of his probation. No additional criminal charges were filed against Swain based on the alleged violations, and the justification for revoking probation was basically that Swain absconded from supervision and failed to report to and complete the Cheyenne Transitional Center's program and the Transitions Residential Program. Without doubt, the State could not have arrested and detained Swain for these acts absent his conviction for the underlying crime. Under the circumstances, we must also conclude the time Swain spent in custody pending resolution of the three revocation proceedings was directly attributable to his underlying battery conviction and, consequently, he is entitled to credit against the underlying three-to-five-year prison sentence. Accordingly, we reverse his sentence and remand the matter to the district court with instructions to give Swain credit against his minimum and maximum sentence for the pre-revocation incarceration time.[1]

Criminal Contempt Conviction
[¶ 12] Swain mounts several challenges to the validity of his conviction for indirect criminal contempt. However, our focus is on a procedural error in the contempt proceeding, which we conclude requires reversal of that conviction.
[¶ 13] The power to punish for contempt is inherent in all courts of general jurisdiction in Wyoming. Skinner v. State, 838 P.2d 715, 723 (Wyo.1992); Connors v. Connors, 769 P.2d 336, 343 (Wyo.1989); Horn v. District Court, Ninth Judicial District, 647 P.2d 1368, 1374-75 (Wyo.1982). Contempts of court are classified as either civil or criminal in nature and, within each classification, either as direct (committed in the court's presence) or indirect contempt (committed outside of the hearing or view of *508 the judge). A civil contempt is remedial; the penalty serves to enforce compliance with a court order or to compensate an injured party. Horn, 647 P.2d at 1372-73. In essence, the contemnor carries the keys of his prison in his own pocket, and can obtain release by complying with the order of the court that sent him there. Connors, 769 P.2d at 343. A criminal contempt, on the other hand, is punitive in character; the penalty serves to vindicate the authority of the court and does not terminate upon compliance with a court order. Horn, 647 P.2d at 1373. While a judgment of civil contempt is conditional and may be lifted when the disobedience ends, punishment for criminal contempt is unconditional and fixed. In essence, criminal contempt is "a crime in every fundamental respect," and a conviction for criminal contempt is indistinguishable from an ordinary criminal conviction. Bloom v. Illinois, 391 U.S. 194, 201, 88 S.Ct. 1477, 1481-82, 20 L.Ed.2d 522 (1968); Skinner, 838 P.2d at 722 n. 5.
[¶ 14] The nature of the contempt charged governs the conduct of, and the procedures to be followed in, a contempt proceeding. Nearly a century ago, the United States Supreme Court addressed the differences between a proceeding instituted and tried as a criminal contempt and a proceeding for civil contempt in Gompers v. Buck's Stove & Range Co., 221 U.S. 418, 31 S.Ct. 492, 55 L.Ed. 797 (1911). In Gompers, two significant principles of law emerged: (1) proceedings in civil contempt are between the original parties and are merely a facet of the original cause of action  they are instituted, tried and treated as a part of the main case; and (2) a criminal contempt prosecution is between the public and the contemnor and is a separate and independent proceeding from, and is not a part of, the original case in which the contempt arose  it is instituted, tried and treated as a distinct criminal action. Id. at 444-51, 31 S.Ct. at 499-502. The Gompers "independent and separate proceeding" rule for indirect criminal contempts has been universally followed over the intervening years. See Bray v. United States, 423 U.S. 73, 75, 96 S.Ct. 307, 309, 46 L.Ed.2d 215 (1975); Matter of Hipp, Inc., 895 F.2d 1503, 1509-10 (5th Cir.1990); United States v. Peterson, 456 F.2d 1135, 1139 (10th Cir.1972); In Re Mowery, 141 Wash. App. 263, 169 P.3d 835, 841 (Div. 1 2007); Bryant v. Howard Cty. Dep't of Social Services ex rel. Costley, 387 Md. 30, 874 A.2d 457, 466-67 (2005); People v. Budzynski, 333 Ill.App.3d 433, 266 Ill.Dec. 713, 775 N.E.2d 275, 280-81 (4 Dist.2002); State v. Roberts, 212 N.J.Super. 476, 515 A.2d 799, 803-04 (App.Div.1986); see also 17 Am.Jur.2d Contempt § 145 (2004); 7A Federal Procedure Lawyers Ed. Contempt § 17:9 (2005); 17 F.R.D. 167, 171-72 (1955).
[¶ 15] This Court endorsed the independent and separate proceeding rule in Garber v. United Mine Workers of America, 524 P.2d 578, 579-80 (Wyo.1974). In Garber, we set aside for lack of jurisdiction a criminal contempt order issued against several subpoenaed witnesses who had failed to appear for a hearing on an employer's complaint for a temporary injunction against a union arising out of a labor dispute. The order to show cause issued to the nonappearing witnesses was filed in and bore the same caption as the original action seeking the injunctive relief. Five of the alleged contemnors were served a copy of the show cause order and appeared at the contempt hearing without an attorney. Although the district court queried them about their understanding of the nature of the proceedings, no response was solicited or received, and they were not advised of the nature of the charges against them. The district court questioned them and found each guilty of contempt. Each were fined $50.00 and sentenced to thirty days in the county jail, with both the fine and jail sentence suspended on the condition that they obey the law and orders, mandates, and subpoenas issued by any court of general jurisdiction for one year. In the course of setting aside the contempt order, we noted that the alleged contemnors would have been informed of the criminal nature of the action through the title of the cause had the contempt matter been properly pursued as an independent action. We observed:
As was said in 1911 in Gompers v. Buck's Stove & Range Co., [221 U.S. 418, 446, 31 S.Ct. 492, 55 L.Ed. 797], the matter should show the court or the public as a party. *509 This is more than a mere matter of form, it advises the defendant that it is a charge and not a suit.... Proceedings in criminal contempts are independent criminal actions and should be conducted accordingly.
Id. at 579.
[¶ 16] In United Mine Workers of America Local 1972 v. Decker Coal Co., 774 P.2d 1274, 1283-84 (Wyo.1989), this Court held the criminal contempt orders issued against two unions and ninety union members for violating a permanent injunction null and void for want of jurisdiction because the contempt matter was not instituted and conducted as an independent action apart from the original cause in which the preliminary injunction issued and the contempt arose. We stated:
Our analysis of W.R.Cr.P. 41(b)[2] [predecessor to W.R.Cr.P. 42] and [the cases of Garber and Tracy, Green & Co. v. Warner, 704 P.2d 1306 (Wyo.1985)[3]] leads us to conclude the district court failed to follow the necessary procedure in issuing the contempt citations to the individual contemnors and the union contemnors. This was, as we have found, a criminal contempt proceeding and should have been conducted as an independent criminal action. It was not, and the district court, therefore, never obtained jurisdiction to proceed. We hold the contempt orders against the individuals and the unions null and void.
Id. at 1284. We reiterated this holding three years later in Crites v. Alston, 837 P.2d 1061, 1072 (Wyo.1992).
[¶ 17] Over the intervening years, we have not overruled or limited the "separate and independent proceeding" requirement espoused in these cases for indirect criminal contempt actions. That requirement leads to the problem in this case. Here, the criminal contempt against Swain was not pursued as an independent criminal action. From the filing of the order to show cause to the entry of the order of contempt against Swain, the criminal contempt action proceeded as an aspect of the underlying criminal case in which the contempt arose, bearing the same docket number as that case. This procedural misstep under existing law mandates a conclusion that the jurisdiction of the district court to proceed on the contempt action was never properly invoked. Accordingly, we must declare the contempt order against Swain null and void.[4]UMWA Local 1972, 774 P.2d at 1284. Having concluded the order of contempt cannot stand, we find it unnecessary to address Swain's asserted errors.[5]
[¶ 18] As a final matter, we would be remiss in not noting the days Swain served in the Laramie County Detention Center on the criminal contempt action. Because this matter is being remanded, we simply reiterate for the district court's consideration what we said in Renfro v. State, 785 P.2d 491, 498 n. 10 (Wyo.1990), concerning sentencing credit:
[W]e would follow generally the standard developed by III ABA Standards for Criminal Justice ... 18.307-08 [(2d ed.1980)]: *510 Standard 18-4.7. Credit for pretrial confinement
(a) Credit against the maximum term and any minimum term should be given to a defendant for all time spent in custody as a result of the criminal charge for which a prison sentence is imposed or as a result of the conduct on which such a charge is based. This should specifically include credit for time spent in custody prior to trial, during trial, pending sentence, pending the resolution of an appeal, and prior to arrival at the institution to which the defendant has been committed.
(b) Credit against the maximum term and any minimum term should be given to a defendant for all time spent in custody under a prior sentence if the defendant is later reprosecuted and resentenced for the same offense or for another offense based on the same conduct. In the case of such a reprosecution, this should include credit in accordance with paragraph (a) for all time spent in custody as a result of both the original charge and any subsequent charge for the same offense or for another offense based on the same conduct.
(c) If a defendant is serving multiple sentences, and if one of the sentences is set aside as the result of direct or collateral attack, credit against the maximum term and any minimum term of the remaining sentences should be given for all time served since the commission of the offenses on which the sentences were based.
(d) If the defendant is arrested on one charge and later prosecuted on another charge growing out of conduct which occurred prior to arrest, credit against the maximum term and any minimum term of any sentence resulting from such prosecution should be given for all time spent in custody under the former charge which has not been credited against another sentence.

CONCLUSION
[¶ 19] We hold Swain is entitled to credit against his penitentiary sentence for the time he was detained pending resolution of the three probation revocation proceedings. We also hold Swain's conviction for indirect criminal contempt cannot be sustained because the district court lacked jurisdiction over the contempt action. We reverse and remand for further proceedings consistent with this opinion.
NOTES
[1]  Given the facts of this case, we deem it appropriate for the district court, rather than this Court, to determine in the first instance the amount of credit to be awarded against Swain's sentence.
[2]  Rule 41(b) provided in relevant part:

(b) Disposition on notice and hearing.  A criminal contempt except as provided in subdivision (a) of this rule [summary disposition] shall be prosecuted on notice. The notice shall state the time and place of hearing, allowing a reasonable time for the preparation of the defense, and shall state the essential facts constituting the criminal contempt charged and describe it as such. The notice shall be given orally by the judge in open court in the presence of the defendant, or on application of the prosecuting attorney, or of an attorney appointed by the court for that purpose, by an order to show cause or an order of arrest.
[3]  In Tracy, Green & Co., we reversed a criminal contempt conviction because the district court failed to comply with the notice requirement of W.R.Cr.P. 41(b).
[4]  We are mindful that W.R.Cr.P. 41(b) was amended in 1992 to its present form found in W.R.Cr.P. 42. However, we see nothing in the language of Rule 42 which would mandate a different result.
[5]  We note that Swain's improper service and double jeopardy claims are raised for the first time in this appeal. While Swain broached the inadequate plea advisement complaint in the district court, he did not buttress it with a cogent legal argument. We find it appropriate under the circumstances for these claims to be resolved in the first instance by the district court should a proper proceeding in law for criminal contempt be instituted against Swain.
