
127 P.3d 350 (2005)
2005 MT 306
329 Mont. 424
Lenorse L. SLAVIN, Petitioner and Appellant,
v.
STATE of Montana, Respondent and Respondent.
No. 03-802.
Supreme Court of Montana.
Submitted on Briefs November 18, 2004.
Decided December 6, 2005.
Rehearing Denied January 4, 2006.
*351 For Appellant: Kristina Neal, Assistant Appellate Defender, Helena, Montana.
For Respondent: Honorable Mike McGrath, Attorney General; Jennifer Anders, Assistant Attorney General, Helena, Montana, Marty Lambert, Gallatin County Attorney, Bozeman, Montana.
Chief Justice KARLA M. GRAY delivered the Opinion of the Court.
¶ 1 Lenorse L. Slavin petitioned the Eighteenth Judicial District Court, Gallatin County, for postconviction relief. The District Court denied the petition and Slavin appeals. We affirm.
¶ 2 We restate the issue as whether the District Court erred in denying Slavin's petition for postconviction relief.

BACKGROUND
¶ 3 Slavin pled guilty to, and was convicted of, partner or family member assault (PFMA) in 1992 and 1993. In August of 2001, he pled guilty to a third PFMA charge, which was a felony because of his two prior convictions. See § 45-5-206(3)(a)(iv), MCA. The District Court imposed sentence and entered judgment. Slavin did not appeal the sentence.
¶ 4 In July of 2002, Slavin filed a pro se petition for postconviction relief in which he alleged the prior PFMA convictions upon which his 2001 felony conviction was based were constitutionally infirm because, in those proceedings, he did not knowingly waive his right to counsel. Slavin further alleged that his trial attorney for the 2001 charge rendered ineffective assistance by failing to investigate the records concerning his prior PFMA convictions and by failing to argue the alleged constitutional infirmities of those prior convictions.
¶ 5 The District Court appointed counsel to represent Slavin in the postconviction proceeding and the State of Montana filed a written response, to which it attached a transcript of the 2001 change of plea hearing and an affidavit by Slavin's trial counsel in that case. The District Court set a hearing on Slavin's petition, during which Slavin withdrew his ineffective assistance of counsel claim. Both Slavin and Deborah Davis-Quitt, the presiding Justice of the Peace in Slavin's two prior PFMA cases, testified at the hearing.
¶ 6 The District Court entered findings of fact, conclusions of law and an order denying the petition. It concluded Slavin had failed to carry his burden of providing direct evidence overcoming the presumption of regularity attached to the prior convictions and, even if such direct evidence existed, the State met its burden of establishing the prior convictions were not obtained in violation of Slavin's constitutional rights. Slavin appeals.

STANDARD OF REVIEW
¶ 7 We review a district court's denial of a petition for postconviction relief to determine whether the court's findings are clearly erroneous and whether the court correctly interpreted the law, including resolution of an issue involving a question of constitutional law. Ellenburg v. Chase, 2004 MT 66, ¶ 10, 320 Mont. 315, ¶ 10, 87 P.3d 473, ¶ 10; State v. Snell, 2004 MT 334, ¶ 16, 324 Mont. 173, ¶ 16, 103 P.3d 503, ¶ 16 (citation omitted). We will affirm a correct result even if the district court reached that result for the wrong reason. Camarillo v. State, 2005 MT 29, ¶ 11, 326 Mont. 35, ¶ 11, 107 P.3d 1265, ¶ 11 (citation omitted).

DISCUSSION
¶ 8 Did the District Court err in denying Slavin's petition for postconviction relief?
¶ 9 Slavin claims on appeal in this postconviction proceeding that he presented direct evidence overcoming the presumption that his two underlying misdemeanor PFMA convictions were valid, and the State failed to establish otherwise. He contends that, because his two prior PFMA convictions were constitutionally infirm, the District Court lacked subject matter jurisdiction to sentence him to a felony for his third offense. He relies on State v. Moorman (1997), 279 Mont. 330, 928 P.2d 145, overruled in part, Peña v. State, 2004 MT 293, ¶ 25, 323 Mont. 347, ¶ 25, 100 P.3d 154, ¶ 25, and State v. LaPier, 1998 MT 174, 289 Mont. 392, 961 P.2d 1274, for *352 the proposition that whether a prior conviction was constitutionally valid is an issue of subject matter jurisdiction which may be raised at any stage of a judicial proceeding, including on postconviction relief.
¶ 10 In Moorman, the postconviction petitioner challenged the dangerous offender designation portion of his sentence, alleging the sentencing court lacked subject matter jurisdiction to impose it. We concluded he was correct and held that, for issues which could have been raised on direct appeal, the procedural bar contained in § 46-21-105(2), MCA, did not apply where the sentencing court lacked subject matter jurisdiction to impose the particular sentence. Moorman, 279 Mont. at 336, 928 P.2d at 149. Similarly, in LaPier, the postconviction petitioner argued the district court did not have jurisdiction to sentence him as a felony offender because one of the prior convictions on which his felony status was based was constitutionally infirm. Without substantively addressing whether the issue was one of subject matter jurisdiction, we cited Moorman for the rule that lack of subject matter jurisdiction is a nonwaivable defect which may be raised at any stage of the proceedings. LaPier, ¶ 9.
¶ 11 We decided Peña after the parties briefed this case for appeal. In Peña, the petition for postconviction relief raised, for the first time, a claim that the sentencing court lacked statutory authority to sentence the defendanta minor when he committed the offenseto more than five years in the custody of the Department of Corrections. We concluded this was not a jurisdictional claim. "An error in sentencing does not divest a district court of subject matter jurisdiction over the case before it." Peña, ¶ 22. Overruling Moorman in part, we stated that the question of whether a district court commits a statutory error in imposing a sentence must not be confused with the question of whether the court had the power or capacity to impose the sentence in the first instance. We determined a claim of an illegal sentence is a nonjurisdictional claim to which the issue preclusion provision of the postconviction statutes contained in § 46-21-105(2), MCA, applies. Peña, ¶ 25.
¶ 12 As in Moorman, the issue in LaPier was whether the district court had statutory authority to impose the sentence it did, not whether the court had the power or capacity to impose sentence in the first instance. In light of Peña, we conclude LaPier is no longer good authority on this point and, to that extent, we overrule LaPier.
¶ 13 Applying Peña to the present case, we conclude Slavin's claim that his two prior convictions could not serve as a basis for charging the 2001 PFMA charge as a felony is a nonjurisdictional claim involving whether the District Court had statutory authority to impose the sentence it did, not whether it had the power or capacity to impose the sentence in the first instance. See Peña, ¶ 22. It is well-established that a guilty plea which is entered knowingly and voluntarily constitutes a waiver of all nonjurisdictional defects and defenses which arose prior to the plea. See, e.g., Ellenburg, ¶ 21 (citations omitted). Consequently, Slavin waived this claim when he pled guilty to felony PFMA.
¶ 14 In addition, and notwithstanding both his conviction pursuant to a guilty plea and the lack of timely objection to the sentence, Slavin could have appealed the legality of his sentence. See, e.g., State v. Gordon, 1999 MT 169, ¶ 29, 295 Mont. 183, ¶ 29, 983 P.2d 377, ¶ 29 (citations omitted). He did not do so. As a result, we conclude § 46-21-105(2), MCA, which precludes consideration in a postconviction proceeding of grounds for relief which could have been raised on direct appeal, bars his sentencing-related claim.
¶ 15 The District Court reached the correct result in denying Slavin's petition for postconviction relief. Accordingly, we affirm.
We concur: JOHN WARNER, PATRICIA O. COTTER and W. WILLIAM LEAPHART.
Justice JAMES C. NELSON concurs.
¶ 16 I join this Opinion with two caveats. First, I concur in the analysis in ¶ 14 only because this case involves the statutory remedy of post-conviction relief. Second, while I joined the Court's decision in Peña v. State, *353 2004 MT 293, 323 Mont. 347, 100 P.3d 154, I have since reconsidered my position and now conclude that Justice Leaphart's concurring and dissenting opinion in that case is correct.
¶ 17 With those caveats, I concur.
