
161 P.3d 846 (2007)
Jerrold CAMPOS, Petitioner,
v.
Erasmo BRAVO, Warden, Respondent.
No. 29,752.
Supreme Court of New Mexico.
April 5, 2007.
Rehearing Denied May 10, 2007.
*847 Gary C. Mitchell, P.C., Timothy Lee Rose, Ruidoso, NM, for Petitioner.
Gary K. King, Attorney General, Margaret McLean, Assistant Attorney General, Santa Fe, NM, for Respondent.

OPINION
CHÁVEZ, Chief Justice.
{1} Asserting that it is unknown whether the jury used a lesser-included offense of second-degree murder as the predicate felony to support his conviction, Petitioner Jerrold Campos seeks a writ of habeas corpus to set aside his felony-murder conviction under the collateral-felony doctrine. At Campos's trial, the jury was instructed to consider either aggravated battery or aggravated burglary as the predicate felony. It is settled law in New Mexico that aggravated battery cannot be used as a predicate felony to felony murder. When it returned its verdict finding Campos guilty of felony murder, the jury did not indicate which predicate felony it used to convict Campos. Because Campos did not preserve the issue and raise it on direct appeal, we review the issue for fundamental error. We conclude that it was error for aggravated battery to be used as one of the two alternative predicates for felony murder and that the error was per se fundamental. Therefore, we reverse the district court's denial of a writ of habeas corpus.
I. BACKGROUND
{2} In 1999, Campos was convicted of felony murder for the killing of Kendrick Rudolph, two counts of intimidation of a witness, and several misdemeanor crimes. For the felony-murder conviction, the State relied on the predicate felonies of aggravated battery with a deadly weapon and, alternatively, aggravated burglary. The verdict form returned by the jury finding Campos guilty of murder did not identify which predicate the jury used. Campos's convictions were appealed directly to this Court and we affirmed in an unpublished decision. State v. Campos, No. 25,715, slip op. ¶ 2 (N.M. Mar. 5, 2001). Over three years later, Campos petitioned the Fifth Judicial District Court for a writ of habeas corpus, amending his petition a couple of weeks thereafter. In his amended petition, Campos asserted that his conviction of felony murder must be vacated because it violates the collateral-felony doctrine. In response, the State argued that Campos could not raise this issue on habeas because he could have raised it on appeal, but did not. The district court held a hearing on December 14, 2004.
{3} At the hearing, Campos's habeas counsel asserted that all involved at every level either missed or were silent about the fact that New Mexico's collateral-felony doctrine clearly precludes aggravated battery from being used as a predicate for felony *848 murder.[1]See State v. Campos, 1996-NMSC-043, ¶ 23, 122 N.M. 148, 921 P.2d 1266 (precluding all forms of aggravated battery and aggravated assault from being used as predicates to felony murder). Relying on State v. Crain, 1997-NMCA-101, 124 N.M. 84, 946 P.2d 1095, counsel also suggested that, in this case, use of aggravated burglary violated the collateral-felony doctrine since Campos's underlying assaultive conduct was the sole basis for the aggravated burglary instruction. See NMSA 1978, § 30-16-4(C) (1963) (providing for aggravated burglary when, without authorization, a person enters a structure with the intent to commit a felony therein and commits a battery upon a person while inside or upon entering or leaving). Finally, Campos's habeas counsel asserted that even if aggravated burglary was a legitimate predicate, Campos's conviction must be vacated because there is no way to know which predicate the jury used and at least one is certainly invalid.
{4} After holding a hearing, the district court entered a "decision" on January 11, 2005, stating: "The Court finds the State's position is correct in this matter and does not feel it necessary to restate that position and denies the Writ." A final order denying relief was not entered until March 20, 2006, over a year later. Soon thereafter, Campos petitioned this Court for a writ of certiorari, which we granted. See Rule 5-802(H)(2) NMRA.
II. A HABEAS PETITIONER MAY ASSERT A CLAIM IF THERE IS FUNDAMENTAL ERROR EVEN IF THE ISSUE COULD HAVE BEEN RAISED ON APPEAL
{5} We first address the State's argument that Campos is precluded from raising this issue in a habeas petition. The purpose of the writ of habeas corpus is to protect a person from being erroneously deprived of his or her rights. Clark v. Tansy, 118 N.M. 486, 490, 882 P.2d 527, 531 (1994). Thus, rarely are principles of finality applied with the same force in habeas proceedings as they are in ordinary litigation. Id. In the words of the United States Supreme Court, "[c]onventional notions of finality of litigation have no place where life or liberty is at stake and infringement of constitutional rights is alleged." Sanders v. United States, 373 U.S. 1, 8, 83 S.Ct. 1068, 10 L.Ed.2d 148 (1963); see also Sobota v. Cox, 355 F.2d 368, 369 (10th Cir.1966) (per curiam) ("A fundamental principle of law in [habeas corpus proceedings] is that the rule of res judicata does not apply.").
{6} At the district court level, the State asserted that Campos was precluded from raising this issue now because he did not raise it on direct appeal. In its briefing to this Court, however, the State appears to contend that the issue was raised on direct appeal, but denied and, therefore, cannot be relitigated. Although both assert Campos cannot raise his claim in a habeas petition, our review under each theory is distinct.
{7} When the State asserts that a habeas petitioner's claim is barred because the same claim was already addressed on appeal, but was denied, the habeas claim is not barred if it "is grounded in facts beyond the record previously presented on appeal, and if the additional facts are those which could not, or customarily would not, be developed in a trial on criminal charges." Duncan v. Kerby, 115 N.M. 344, 346, 851 P.2d 466, 468 (1993) (quoted authority omitted). *849 When the State asserts that a habeas petitioner's claim is barred because the petitioner failed to raise the issue on appeal, a different rule applies. "A habeas corpus petitioner will not be precluded . . . from raising issues . . . that could have been raised on direct appeal either when fundamental error has occurred, or when an adequate record to address the claim properly was not available on direct appeal." Id. (citation omitted).
{8} After reviewing the briefs in Campos's direct appeal and our resulting decision, we conclude that Campos never raised the collateral-felony issue on appeal. See Garcia v. Mora Painting & Decorating, 112 N.M. 596, 601, 817 P.2d 1238, 1243 (Ct.App.1991) (taking judicial notice of briefs filed in another case). Regarding the use of different predicate felonies in support of his felony-murder conviction, the thrust of Campos's argument on appeal was that he did not receive sufficient notice of the predicates to be used because he was not actually charged with those crimes. Nowhere in his brief-in-chief, nor in his reply brief, did Campos assert that his felony-murder conviction violated the collateral-felony doctrine. As a result, on the issue of the predicate felonies used to support his conviction of felony murder, our decision only addressed whether Campos received sufficient notice. Campos, No. 25,715, slip op. at 3-4. Because Campos never raised this issue on appeal and because the record on appeal was clearly adequate to address Campos's current claim, we determine only whether Campos's conviction constitutes fundamental error. In conducting such a review, we first determine if error occurred; if so, we next determine whether that error was fundamental. See State v. Barber, 2004-NMSC-019, ¶ 13, 135 N.M. 621, 92 P.3d 633.
III. ERROR OCCURRED AT CAMPOS'S TRIAL BECAUSE THE AGGRAVATED-BATTERY ALTERNATIVE WAS LEGALLY INADEQUATE UNDER THE COLLATERAL-FELONY DOCTRINE
A. Using Aggravated Battery as the Predicate to Felony Murder Violated the Collateral-Felony Doctrine
{9} In New Mexico, our felony-murder statute serves to elevate second-degree murder to first degree when the murder occurs during the commission of a dangerous felony. See State v. Ortega, 112 N.M. 554, 563, 817 P.2d 1196, 1205 (1991). In concert with the general trend in America of limiting its reach, New Mexico has placed five limitations on felony murder. See State v. O'Kelly, 2004-NMCA-013, ¶¶ 22-24, 135 N.M. 40, 84 P.3d 88. One of the limitations is the collateral-felony doctrine, which precludes the State from using a lesser-included offense of second-degree murder as the predicate to felony murder. Id. ¶ 24 (citing Campos, 1996-NMSC-043, ¶ 19, 122 N.M. 148, 921 P.2d 1266).
{10} The collateral-felony doctrine derived from our concern "that the prosecution may be able to elevate improperly the vast majority of second-degree murders to first-degree murders by charging the underlying assaultive act as a predicate felony for" felony murder. Campos, 1996-NMSC-043, ¶ 19, 122 N.M. 148, 921 P.2d 1266. Thus, the doctrine requires the predicate felony to be collateral to the murder, which, in turn, precludes the State from using a lesser-included offense of second-degree murder as a predicate felony. See id. ¶¶ 10, 19. Moreover, applying the strict-elements test "in the abstract," see State v. Vallejos, 2000-NMCA-075, ¶ 13, 129 N.M. 424, 9 P.3d 668, it is clearly not possible to commit second-degree murder without also committing some form of aggravated assault or aggravated battery. Thus, aggravated assault and aggravated battery may never be used as predicate felonies to felony murder even though some statutory elements of those two crimes differ from second-degree murder. Campos, 1996-NMSC-043, ¶ 23, 122 N.M. 148, 921 P.2d 1266. Ultimately, the doctrine's purpose "is to further the legislative intent of holding certain second-degree murders to be more culpable when effected during the commission of a felonythereby elevating them to first-degree murderswhile maintaining the important distinction between the classes of second- and first-degree murders." Id. ¶ 22.
{11} Analysis under the collateral-felony doctrine is not to be confused with a double jeopardy analysis. First, under a collateral-felony analysis we consider whether the *850 predicate felony is a lesser-included offense of second-degree murder. Under a double jeopardy analysis, we consider whether the predicate offense is a lesser-included offense of first-degree murder. Id. ¶ 22 n. 3. Furthermore, when the collateral-felony doctrine is violated, the defendant's felony-murder conviction is vacated, whereas when double jeopardy is violated, the conviction of the predicate felony is vacated. See id. Finally, when two charges violate double jeopardy because the conduct underlying each is "unitary," the collateral-felony doctrine is not necessarily violated. See id. ¶ ¶ 25, 48 (holding that first-degree criminal sexual penetration was a proper predicate felony under the collateral-felony doctrine notwithstanding the fact that double jeopardy was violated because the conduct was "unitary"). As was stated in Vallejos, "[t]he two doctrines are distant cousins if anything, and one acts at one's peril in drawing superficial parallels between the two." 2000-NMCA-075, ¶ 12, 129 N.M. 424, 9 P.3d 668. Double jeopardy is not at issue in this case.
{12} Since it is not possible to commit second-degree murder without also committing some form of aggravated battery, Campos's conviction of felony murder would be legally void if the jury used aggravated battery with a deadly weapon as the predicate felony. We meant what we said in Campos: all forms of aggravated assault and aggravated battery will "always be deemed to be non-collateral." 1996-NMSC-043, ¶ 23, 122 N.M. 148, 921 P.2d 1266. On certiorari, the State concedes as much, stating in its answer brief: "If . . . the only predicate felony for the felony murder charge was aggravated battery, the collateral felony doctrine would clearly apply." However, since the predicate felonies were submitted to the jury as alternates and we do not know which the jury relied upon, we are left with the question of whether aggravated burglary was an appropriate predicate and, if so, whether this cured any error.
B. Using Aggravated Burglary Based on Campos's Underlying Assaultive Conduct Did Not Violate the Collateral-Felony Doctrine
{13} To be guilty of aggravated burglary, a defendant must, without authorization, enter a structure with the intent to commit a felony therein, and either: (1) be armed with a deadly weapon, (2) arm himself with a deadly weapon while inside, or (3) commit a battery upon a person while inside, or while entering or leaving. § 30-16-4. At Campos's trial, the jury instruction stating the elements of aggravated burglary relied upon the battery prong, not on either of the deadly weapon prongs. Thus, Campos argues that "since the basis for the predicate felony of Aggravated Burglary involved the underlying assaultive conduct, it too would violate the collateral-felony doctrine."
{14} Because this argument is answered by Campos and State v. Duffy, 1998-NMSC-014, 126 N.M. 132, 967 P.2d 807, we disagree. In Duffy, after killing an elderly woman while snatching her purse, the defendant was convicted of felony murder predicated on robbery. Id. ¶¶ 1-2. Among other things, the defendant argued that the collateral-felony doctrine was violated "because the robbery . . . was the same act that caused [the victim's] death." Id. ¶ 23. We stated in Duffy that Campos requires us to "look, not to the nature of the act, but rather to whether the legislature intended that a particular felony should be able to serve as a predicate to felony murder." Id. (emphasis added) (citing Campos, 1996-NMSC-043, ¶ 22, 122 N.M. 148, 921 P.2d 1266). Because it is "possible to commit murder without also committing robbery," it was clear to us that the legislature did not intend to prohibit robbery from being used as the predicate to felony murder. Id. ¶ 25. Thus, notwithstanding the fact that the same conduct underlay each charge, we upheld the defendant's conviction of felony murder. Id. ¶ 28. Similarly, in Campos the defendant's conduct underlying his conviction of criminal sexual penetration (CSP) and felony murder was "unitary." Campos, 1996-NMSC-043, ¶ 48, 122 N.M. 148, 921 P.2d 1266. Nevertheless, since it is not a lesser-included offense of second-degree murder, we held that CSP was properly used as a predicate for felony murder. Id. ¶ 25.
{15} It is possible to commit second-degree murder without ever committing some *851 form of aggravated burglary. Even in the situation, as here, where the factor raising simple burglary to aggravated burglary is the conduct underlying a second-degree murder, the fact remains that two elements of burglarywhether aggravated or notnever contained in second-degree murder are: (1) the unauthorized entry of a structure, and (2) the intent to commit a felony therein. See NMSA 1978, § 30-16-3 (1971). Simple burglary is collateral to second-degree murder and does not violate the collateral-felony doctrine. As such, it is irrelevant that the element raising simple burglary to aggravated burglary in this case was that of Campos's underlying murderous battery. Thus, aggravated burglary was correctly used as a predicate to felony murder.
{16} Finally, we note that Campos's reliance on Crain is misplaced. The issue in Crain was whether the defendant's right to be free from double jeopardy was violated when he was convicted of three statutory provisions for conduct that was "unitary." 1997-NMCA-101, ¶¶ 15-17, 124 N.M. 84, 946 P.2d 1095. As discussed above, the collateral-felony doctrine is an issue distinct from double jeopardy and care must be taken not to conflate the two.
C. Error Occurred Because One of the Alternatives Was Legally Inadequate
{17} Campos asserts that even if aggravated burglary was a valid predicate in this case, his felony-murder conviction must be vacated because the aggravated-battery predicate was clearly not valid. According to the State, since substantial evidence supports the valid predicate felony of aggravated burglary, no error occurred and we should uphold Campos's conviction of felony murder. See State v. Salazar, 1997-NMSC-044, ¶ 32, 123 N.M. 778, 945 P.2d 996. Error occurred at Campos's trial because one of the alternative bases for his conviction was legally inadequate. See State v. Olguin, 120 N.M. 740, 741, 906 P.2d 731, 732 (1995). Had Campos preserved this issue and raised it on direct appeal, we would undoubtedly have vacated his conviction and remanded for a new trial. However, as noted, our review here is for fundamental error. We recognized in State v. Cunningham that not affording more scrutiny for fundamental error "would eliminate the preservation of error requirement of our appellate jurisprudence. It would also compromise the intent embodied in Rule 12-216, which makes fundamental error an exception to the general rule requiring preservation of error." 2000-NMSC-009, ¶ 18, 128 N.M. 711, 998 P.2d 176.
IV. THE ERROR WAS PER SE FUNDAMENTAL
{18} Fundamental error consists of error that goes to: (1) the foundation of a defendant's rights, (2) the foundation of the case, or (3) a right essential to the defense of an accused, "which no court could or ought to permit him to waive." State v. Garcia, 46 N.M. 302, 309, 128 P.2d 459, 462 (1942). Over the years, the doctrine has evolved such that a conviction will only be reversed if the defendant's guilt is so questionable that upholding a conviction would "shock the conscience," or where, notwithstanding the apparent culpability of the defendant, "substantial justice" has not been served. See State v. Osborne, 111 N.M. 654, 662-63, 808 P.2d 624, 632-33 (1991). Substantial justice has not been served when a fundamental unfairness within the system has undermined judicial integrity. See Cunningham, 2000-NMSC-009, ¶ 21, 128 N.M. 711, 998 P.2d 176.
{19} We start with the premise that "[i]t is fundamental error to convict a defendant of a crime that does not exist." State v. Maestas, 2007-NMSC-001, ¶ 9, 140 N.M. 836, 149 P.3d 933 (citing State v. Johnson, 103 N.M. 364, 371, 707 P.2d 1174, 1181 (Ct.App.1985)). Because a conviction violating the collateral-felony doctrine is a legal nullity, it would be fundamental error to uphold such a conviction. However, in this case the jury was instructed on alternativesone legally adequate, the other legally inadequate. Relying on Yates v. United States, 354 U.S. 298, 312, 77 S.Ct. 1064, 1 L.Ed.2d 1356 (1957), overruled on other grounds by Burks v. United States, 437 U.S. 1, 98 S.Ct. 2141, 57 L.Ed.2d 1 (1978), we stated in Olguin that "a conviction under a *852 general verdict must be reversed if one of the alternative bases of conviction is legally inadequate." Olguin, 120 N.M. at 741, 906 P.2d at 732. We reaffirm this principle yet, at the same time, note also that before reversal is required on the ground that one of the alternatives is legally inadequate, Yates insists that it also be "impossible to tell which ground the jury selected"something that was not mentioned in Olguin. Yates, 354 U.S. at 312, 77 S.Ct. 1064. In this case, without the jury returning a special verdict detailing which theory of felony murder it relied upon, it is simply impossible for us to determine which ground the jury selected.
{20} A similar situation is found in Mosely v. State, 682 So.2d 605 (Fla.Dist.Ct.App. 1996). In Mosely, the trial court instructed the jury that it could find the defendant guilty of attempted manslaughter if it determined that the defendant acted intentionally or with culpable negligence. Id. at 606. The culpable negligence instruction was in error because it would have permitted the jury to find the defendant guilty of attempted involuntary manslaughter, a nonexistent crime in Florida. See id. The State argued that the error was not fundamental because no evidence or argument was presented on the culpable negligence theory. Id. Nonetheless, and notwithstanding the fact that there was evidence adduced at trial showing that the defendant acted intentionally, the appellate court could not determine beyond a reasonable doubt that the jury did not rely upon the erroneous instruction. Id. at 607. In fact, the court adopted a bright-line rule: "When jurors are given an instruction that would permit them to find the defendant guilty of a crime that does not exist, the error is fundamental and is per se reversible, and the case must be remanded for retrial." Id.
{21} In this case there was plenty of evidence showing that Campos was guilty of the valid predicate felony, aggravated burglary. That said, we simply cannot say beyond a reasonable doubt that the jury did not rely upon the invalid predicate. Doing so would be tantamount to directing a verdict finding Campos guilty of felony murdersomething we are loathe to do. Since we have no idea whether Campos was convicted of a valid crime, substantial justice was not served at Campos's trial; fundamental error results. We reverse the district court, grant Campos a writ of habeas corpus, vacate his conviction of felony murder, and remand for a new trial should the State elect to retry Campos using a valid predicate felony.
V. CONCLUSION
{22} Campos is not precluded from raising his argument for the first time in a petition for a writ of habeas corpus. Because an adequate record was available to Campos on appeal, we review for fundamental error. We cannot say for certain that the jury did not rely on the legally invalid predicate of aggravated battery; thus, fundamental error occurred. We reverse the district court and grant Campos a writ of habeas corpus.
{23} IT IS SO ORDERED.
WE CONCUR: PATRICIO M. SERNA, and RICHARD C. BOSSON, Justices.
hMINZNER, Justice (specially concurring).
{24} I concur in the majority opinion. I write separately in order to express my concern that the concept and term "fundamental error" may not be exactly the same when reviewing for fundamental error in the context of a habeas proceeding as when reviewing for fundamental error in the context of a direct appeal. Our cases do not make this point directly or clearly, but Duncan v. Kerby, 115 N.M. 344, 346, 851 P.2d 466, 468 (1993), suggests a difference.
{25} In Duncan, Justice Frost indicated that "[a] habeas corpus petitioner will not be precluded, however, from raising issues in habeas corpus proceedings that could have been raised on direct appeal either when fundamental error has occurred, [State v.] Gillihan, 86 N.M. [439], 440, 524 P.2d [1335], 1336 [(1974)], or when an adequate record to address the claim properly was not available on direct appeal." 115 N.M. at 346, 851 P.2d at 468. Yet he went on to quote an Idaho case, in which a special concurrence made the point that "`[w]hen a post-conviction application makes a substantial showing that due process or another fundamental *853 right has been abridged-and the application is supported by facts ill-suited for development in the original trial-it should be addressed on its merits.'" Id. (quoting State v. Darbin, 109 Idaho 516, 708 P.2d 921, 931 (Ct.App.1985)) (Burnett, J., specially concurring). This Court then said: "We adopt this rationale." Duncan, 115 N.M. at 346, 851 P.2d at 468.
{26} In Gillihan, this Court said that post-conviction proceedings were not available as a substitute for an appeal or to correct trial error. 86 N.M. at 440, 524 P.2d at 1336. Yet, we said "this holding will not apply to grounds constituting fundamental error or to situations in which the prisoner's mental capacities preclude an intelligent waiver." Id.
{27} Finally, in State v. Garcia, we said post-conviction proceedings ordinarily are not to be used to correct trial error "even though the errors relate to constitutional rights. It is only where there has been a denial of the substance of fair trial that the validity of the proceeding may be attacked collaterally." 80 N.M. 21, 23, 450 P.2d 621, 623 (1969).
{28} These various pronouncements by this Court leave me in doubt concerning the scope of the principle and concept of fundamental error as it applies in habeas proceedings. Nevertheless, as the majority opinion makes clear, Petitioner is being held in prison on a conviction that is legally void. See Maj. Op., ¶ 12. As a consequence, whatever the scope of review under the principle and concept of fundamental error, he is entitled to the relief he sought. See NMSA 1978, § 44-1-1 (1884) (describing those who are entitled to the writ of habeas corpus as including every person imprisoned or restrained unlawfully).
I CONCUR: PETRA JIMENEZ MAES, Justice.
NOTES
[1]  The same attorney represented the State at trial and during the habeas proceeding. At the habeas hearing, the prosecutor candidly admitted that "it wasn't a mistake on [his] part-[he] set it up on purpose this way." The prosecutor used aggravated battery as one of the predicates "on purpose because [he] wanted [this Court] to reexamine the felony-murder rule." We do not approve of the tactic of purposefully setting up a conviction that has a clear possibility of being illegal in the hopes that this Court will overturn its clear precedent. Under our Rules of Professional Conduct, a prosecutor shall not pursue charges not supported by probable cause. Rule 16-308(A) NMRA. The same rule does not allow a prosecutor to pursue a crime that is clearly invalid under our precedent. Moreover, "`[i]t is as much [a prosecutor's] duty to refrain from improper methods calculated to produce a wrongful conviction as it is to use every legitimate means to bring about a just one.'" State v. Cummings, 57 N.M. 36, 39, 253 P.2d 321, 323 (1953) (quoting Berger v. United States, 295 U.S. 78, 88, 55 S.Ct. 629, 79 L.Ed. 1314 (1935)); see also State v. Cooper, 2000-NMCA-041, ¶ 15, 129 N.M. 172, 3 P.3d 149 ("The sole duty of a prosecutor is to see that justice is done.").
