Bass appeals from the dismissal of his petition for writ of habeas corpus.
Under the sparse facts as alleged Bass is serving concurrently two 25-year terms in Florida for felony murder convictions. Bass pled nolo contendere to the charges, reserving his right to appeal in state court the denial of his motion to suppress a con*1206fession. After exhausting state remedies Bass filed a petition for writ of habeas corpus in 1979, contending that his confession was obtained in violation of his constitutional rights. This petition was dismissed for failure to state a claim upon which relief can be granted, the district court relying on McMann v. Richardson, 397 U.S. 759, 90 S.Ct. 1441, 25 L.Ed.2d 763 (1970) and Tollett v. Henderson, 411 U.S. 258, 93 S.Ct. 1602, 36 L.Ed.2d 235 (1973), which hold that a guilty plea bars constitutional attacks on pretrial proceedings. This ruling was not appealed.
In this second action petitioner raises the identical claim, namely, that his confession was taken in violation of his constitutional rights. The district court dismissed this petition without a hearing, ruling that the merits had been decided in the first petition. We reverse.
The doctrine of res judicata is not applicable to habeas corpus because “conventional notions of finality of litigation have no place where life or liberty is at stake and infringement of constitutional rights is alleged.” Sanders v. U. S., 373 U.S. 1, 8, 83 S.Ct. 1068, 1073, 10 L.Ed.2d 148 (1963); Goins v. Allgood, 391 F.2d 692, 695 (5th Cir. 1968). Nevertheless, several authorities prevent the use of repetitive petitions for writ of habeas corpus by enforcing a modified doctrine of finality. Sanders, supra, 373 U.S. at 15-19, 83 S.Ct. at 1077-1079; 28 U.S.C. § 2244;1 28 U.S.C. § 2254 Rule 9(b).2 The doctrine of finality under these authorities is a uniform one3 and is explained thoroughly in Sanders. There are two branches to the Sanders doctrine. The first applies to successive petitions that allege no new grounds for relief. The second applies to successive petitions that allege new grounds that might have been alleged in a prior petition. Under the first branch the district court has discretion to dismiss the petition if the prior petition was adjudicated on the merits and the ends of justice would not be served by considering the merits again in the subsequent petition. In this situation the burden lies with the petitioner to demonstrate that a reconsideration would serve the ends of justice. Under the second branch the district court must address a new ground unless the failure to prosecute the ground earlier is shown by the government to be an abuse of the writ. 373 U.S. at 15-19, 83 S.Ct. at 1077-1079.
This case falls under the first branch of Sanders because the gravamen of the constitutional complaint is the same in both petitions. The “legal basis for granting relief” was not altered. See Sanders, 373 U.S. at 16, 83 S.Ct. at 1077.
The prior petition was decided on its merits. The district court ruled that Bass failed to state a claim upon which relief can be granted. It is clear from the authorities the court cited that the basis of its ruling was that no habeas relief is available for pretrial infirmities when the petitioner pleads nolo contendere. See McMann and Tollett, supra. Such a ruling is a disposi*1207tive one on the legal merits of the petition and not merely a ruling that the form of pleading was improper. Compare Sanders, 373 U.S. at 19-20, 83 S.Ct. at 1079-1080. Accord Sinclair v. Blackburn, 599 F.2d 673, 675 (5th Cir. 1979), cert. denied, 444 U.S. 1023, 100 S.Ct. 684, 62 L.Ed.2d 656 (1980) (determination that no relief can be granted assuming the truth of all the facts stated is “on the merits”). Petitioner objects that the Sanders finality doctrine is not met unless a full evidentiary hearing was held in the prior petition. It is true that where material factual issues are in dispute a determination is not on the merits unless an evidentiary hearing was held, Sanders, 373 U.S. at 16, 83 S.Ct. at 1077. This does not mean, however, that a merits ruling cannot be made purely on legal grounds; the Supreme Court contemplated such rulings in addition to the factual rulings on which it primarily focused. See id. (referring to cases where “purely legal questions are involved”).
Whether the district court has discretion to dismiss the petition thus turns on whether the ends of justice would be served by considering this subsequent petition. We conclude that the district court was in error in deciding that justice would not be served. Under the facts as alleged in this petition the district court in ruling on the prior petition was plainly in error in holding that McMann and Tollett barred relief. These cases established the rule that a guilty plea bars constitutional attacks on prior proceedings such as the taking of a confession. McMann and Tollett were expressly distinguished, however, in Lefkowitz v. Newsome, 420 U.S. 283, 95 S.Ct. 886, 43 L.Ed.2d 196 (1975), where the Court held that a defendant who pleads guilty preserves his right to bring constitutional challenges on those issues that state law allows the defendant to pursue on appeal. At the time of Bass’s conviction Florida law allowed a defendant to plead nolo contendere and to reserve an appeal from a denial of a motion to suppress. See Giannetta v. State, 296 So.2d 654 (Fla.App.1974); Stanley v. Wainwright, 604 F.2d 379, 380-81 n.1 (5th Cir.), cert. denied, 447 U.S. 925, 100 S.Ct. 3019, 65 L.Ed.2d 1118 (1980). Bass contends that he made such a reservation of his right to appeal, and so the dismissal of his petition was plain error.4 Where purely legal questions were involved in the original determination of the petition the Supreme Court has said that the ends of justice require a redetermination “upon showing an intervening change in the law or some other justification for having failed to raise a crucial point or argument.” Sanders, 373 U.S. at 17, 83 S.Ct. at 1078. The Court was quick to observe, though, that “the foregoing enumeration is not intended to be exhaustive; the test is ‘the ends of justice’ and it cannot be too finely particularized.” Id. We agree with the Ninth Circuit that an additional instance where the ends of justice would be served occurs when the first habeas court committed plain error: “The ends of justice are not served by refusal to consider the merits of the second application when the denial of the first rested on a court’s plain errors of law.” Cancino v. Craven, 467 F.2d 1243, 1246 (9th Cir. 1972). As just explained, there was j)lain error in the original dismissal.
The equities in favor of entertaining Bass’s second ¡>etition are mitigated somewhat, however, by the fact that he did not appeal the decision in his first case. But this is not sufficient cause to rest the merits of Bass’s claim on a decision that was plain error unless the failure to appeal was deliberate or amounted to an abuse of the writ. Cf. Sanders, 373 U.S. at 17-18, 83 S.Ct. at 1078-1079. We are unable to determine from the record whether Bass’s failure to appeal was such an abuse as to outweigh the interests of justice commanded by a plain error determination of the merits because there has been no hearing or finding *1208on whether Bass’s failure to appeal was deliberate.5
Although the burden of proof in the ends of justice determination is on Bass, the district court erred in dismissing his petition without providing an opportunity to be heard on this issue. In dictum the former Fifth Circuit has stated that “under all the circumstances of this case, [t]he applicant was entitled at least to an opportunity to meet his burden to show that .. . the ends of justice would be served by a redetermination of the [ground].” Goins v. Allgood, 391 F.2d 692, 696 (5th Cir. 1968). This view is also expressed in the Advisory Committee Notes to 28 U.S.C. § 2254 Rule 9:
If it appears to the court . . . that there is a high probability that the petition will be barred . . ., the court ought to afford petitioner an opportunity to explain his apparent abuse. . . . This conforms with Johnson v. Copinger, 420 F.2d 395 (4th Cir. 1969), where the court stated:
[T]he petitioner is obligated to present facts demonstrating that his earlier failure to raise his claims is excusable and does not amount to an abuse of the writ. However, it is inherent in this obligation . . . that he must be given an opportunity to make his explanation, if he has one. If he is not afforded such an opportunity, the requirement that he satisfy the court that he has not abused the writ is meaningless. Nor do we think that a procedure which allows the imposition of a forfeiture for abuse of the writ, without allowing the petitioner an opportunity to be heard on the issue, comports with the minimum requirements of fairness.
The question of whether Bass’s failure to appeal was deliberate is of sufficient factual importance to the ends of justice calculus in this case that, under these authorities, Bass deserved “an opportunity to make his explanation.”
The judgment of the district court is VACATED and the case REMANDED for further proceedings not inconsistent with this opinion.