
272 P.3d 319 (2012)
2012 WY 40
Joseph DAX, Appellant (Defendant),
v.
The STATE of Wyoming, Appellee (Plaintiff).
No. S-11-0182.
Supreme Court of Wyoming.
March 19, 2012.
Representing Appellant: Joseph F. Dax, Pro se.
Representing Appellee: Gregory A. Phillips, Wyoming Attorney General; Terry L. Armitage, Deputy Attorney General; D. Michael Pauling, Senior Assistant Attorney General; and Justin A. Daraie, Assistant Attorney General.
Before KITE, C.J., and GOLDEN, HILL, VOIGT, and BURKE, JJ.
HILL, Justice.
[¶ 1] Joseph F. Dax filed this pro se appeal contesting an order denying him credit for time served. Dax claims he should receive *320 credit against his state sentence for time spent in pre-trial detention on a federal charge. We affirm.

ISSUE
[¶ 2] Although no issue is stated in Dax's brief, he argues in the body of his brief that his state sentence should be credited with time served, beginning from his date of arrest on the federal charge.

FACTS
[¶ 3] Both Dax's state and federal prosecution arise from a Casper burglary that involved theft of firearms in violation of 18 U.S.C. § 922(g)(1). In May of 2002 federal authorities arrested Dax on a charge of a felon in possession of firearms. Shortly thereafter, the State charged Dax with aiding and abetting burglary in violation of Wyo. Stat. Ann. §§ 6-3-301(a)(c)(i) and 6-1-201 (LexisNexis 2011) and with conspiracy to commit burglary in violation of Wyo. Stat. Ann. § 6-1-303 (LexisNexis 2011). The State also lodged a detainer and requested that Dax be transferred to State custody after the federal prosecution.
[¶ 4] In August of 2002 Dax pled guilty to the federal charge, and in November of 2002 the federal court sentenced him to a minimum term of 15 years in prison. That same month, the State acquired custody of Dax and its prosecution proceeded. Dax also pled guilty at the state level to aiding and abetting, while the conspiracy charge was dismissed. The State agreed that Dax's state sentence would be served concurrently with the federal sentence. In April of 2003 the state district court sentenced Dax to 20 to 25 years to run concurrently with the federal sentence. At that time, Dax requested credit for time served, and the district court ruled that Dax was entitled to credit for time he served solely on the state charge but that he was not entitled to credit for time he served while he served the federal sentence. The State argued that Dax was not entitled to any credit because the federal court imposed sentence before he was transferred to state custody. The state judgment and sentence was silent on the matter of credit for time served.
[¶ 5] Subsequent to the judgment and sentence, Dax began four legal proceedings. First, he took a direct appeal but voluntarily dismissed it in December of 2003. Second, in April of 2004 he filed a motion for sentence reduction based on good behavior and in that motion requested credit for time served in federal pre-trial confinement. The district court denied that motion without a hearing and Dax did not appeal. Third, in December of 2004 Dax filed another motion for sentence reduction. The State actually supported this motion because Dax had cooperated against another offender. In the motion Dax again requested credit for pre-sentence confinement but did not specify whether he meant federal presentence confinement or state presentence confinement, or both. The district court denied the motion this time after a hearing and again Dax did not appeal. Fourth, and finally, Dax instituted this present action in May of 2011.
[¶ 6] In this action Dax filed a pro se motion to correct an illegal sentence. He again requested credit for time served, which the district court denied and stated:
Defendant is not entitled to credit for time served in this case because he has failed to show that his confinement was attributable only to the specific charges in this case. Defendant's motion indicates that he was arrested on May 31, 2002, on a federal criminal charge. Defendant then states that on or about May 31, 2002, a detainer was lodged against him by the State of Wyoming for charges that led to the sentence in the above-captioned case. Defendant has failed to show that he would have been released from federal custody if the State of Wyoming had not placed a detainer.
This appeal followed.

STANDARD OF REVIEW
[¶ 7] "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." Baker v. State, 2011 WY 53, ¶ 8, 248 P.3d 640, 642 (Wyo.2011). However, we will dispose of this appeal upon other grounds.


*321 DISCUSSION
[¶ 8] Dax's issue on appeal is that he should receive credit against his state sentence for time spent in pre-trial detention on the federal charge. The State argues that the doctrine of res judicata bars review of the issue raised by Dax because he failed to raise the issue earlier. We agree.
[¶ 9] The doctrine of res judicata bars litigation of issues that were or could have been determined in a prior proceeding. Martinez v. State, 2007 WY 164, ¶ 15, 169 P.3d 89, 92 (Wyo.2007). Four factors are used to determine the applicability of the doctrine: "(1) identity in parties; (2) identity in subject matter; (3) the issues are the same and relate to the subject matter; and (4) the capacities of the persons are identical in reference to both subject matter and the issues between them." Id. ¶ 11, 169 P.3d at 91 (quoting Lacey v. State, 2003 WY 148, ¶ 11, 79 P.3d 493, 495 (Wyo.2003)).
[¶ 10] As we recently stated in Cooper v. State, 2010 WY 22, ¶ 6, 225 P.3d 1070, 1072 (Wyo.2010):
We have repeatedly held that claims brought pursuant to W.R.Cr.P. 35(a) are subject to the principles of res judicata. McCarty v. State, 929 P.2d 524, 525 (Wyo.1996); Lacey v. State, 2003 WY 148, ¶ 11, 79 P.3d 493, 495 (Wyo.2003); Dolence v. State, 2005 WY 27, ¶ 6, 107 P.3d 176, 178 (Wyo.2005); Amin v. State, 2006 WY 84, ¶ 5, 138 P.3d 1143, 1144 (Wyo.2006). We have also repeatedly held that the res judicata doctrine applies when a defendant could have raised such an issue in an earlier appeal or motion for sentence reduction but did not do so. Hamill v. State, 948 P.2d 1356, 1358-59 (Wyo.1997); Mead v. State, 2 P.3d 564, 566 (Wyo.2000); Gould [v. State, 2006 WY 157], ¶ 16, 151 P.3d [261], 266 [(Wyo.2006)].

McDaniel [v. State], 2007 WY 125, ¶ 9, 163 P.3d [836] at 838 [(Wyo.2007)].
[¶ 11] If a party fails to "show good cause why the issue was not raised at an earlier opportunity, the court may decline to consider the issue." Hamill v. State, 948 P.2d 1356, 1358 (Wyo.1997).
[¶ 12] As noted in the facts, Dax had three prior opportunities to present his sentencing-credit claim to this Court. The parties addressed the issue at his sentencing in April of 2003 and the court denied him credit against his state sentence. Dax filed a notice of appeal but voluntarily dismissed the case before submitting a brief to this Court. In April of 2004 he filed a motion for sentence reduction, which included a request for credit against his state sentence. Those requests were denied. No appeal was filed. He again moved for a sentence reduction in December of 2004 and again stated, although with no specificity, that he was entitled to credit against his state sentence. Again, the district court denied that matter and Dax took no appeal. Having raised the issue three times in district court, and having failed to appeal any of the court's unfavorable decisions, res judicata applies in this instance.

CONCLUSION
[¶ 13] Res judicata bars review of the issue raised by Dax because he did not take advantage of the opportunity to raise it multiple times before. Here, he has not shown good cause to excuse those failures. Affirmed.
