
595 F.3d 844 (2010)
Johnnie KING, Petitioner-Appellant,
v.
UNITED STATES of America, Respondent-Appellee.
No. 09-2212.
United States Court of Appeals, Eighth Circuit.
Submitted: January 12, 2010.
Filed: February 23, 2010.
*847 Lee Lawless, AFPD, argued, St. Louis, MO, for Appellant.
Thomas Joseph Mehan, AUSA, argued, St. Louis, MO, for Appellee.
Before MURPHY and BYE, Circuit Judges, and STROM,[1] District Judge.
MURPHY, Circuit Judge.
Before the court is Johnnie King's appeal from the denial of his motion to vacate his sentence pursuant to 28 U.S.C. § 2255. After King pled guilty to one count of possession of crack cocaine with intent to distribute, he was sentenced as a career offender under U.S.S.G. § 4B1.1 to a term of 196 months. King's direct appeal was dismissed on the basis of an appeal waiver in his plea agreement. That agreement preserved the right to raise a claim of ineffective assistance of counsel in a collateral proceeding, however.
King brought this § 2255 petition pro se, raising a relatively sophisticated argument about the application of the United States Sentencing Guidelines. He argues that the sentencing court erred in its application of U.S.S.G. § 4A1.2(a)(2), the guideline grouping rule for assigning criminal history points to prior felonies, and § 4B1.2(c), which defines the felonies that count as predicates for the career offender guideline. King contends that he should not have been sentenced under § 4B1.1 because only one of his prior felonies was a career offender predicate under these provisions, and that his attorney was unconstitutionally ineffective for failing to raise this issue.
The district court denied King's petition for relief, but granted his request for a certificate of appealability. We vacate King's sentence and remand for resentencing.

I.
Johnnie King pled guilty to one charge of possession with intent to distribute more than 50 grams of a substance containing cocaine base, in violation of 21 U.S.C. § 841(a)(1). The 2005 edition of the United States Sentencing Guidelines Manual applied to his sentencing. King's plea agreement recommended that he be sentenced under U.S.S.G. § 2D1.1(c)(4) with a three level reduction for acceptance of responsibility. It originally recommended an incorrect guideline and base offense level of 26, but the parties recognized that mistake before sentencing and later agreed that the base offense level should be 32. The agreement also provided that King waived his right to appeal sentencing issues "[i]n the event the Court accepts the plea and, in sentencing the defendant . . . applies the recommendations agreed to by the parties herein." In *848 addition King waived "all rights to contest the conviction or sentence in any post-conviction proceeding . . . except for claims of prosecutorial misconduct or ineffective assistance of counsel."
The PSR projected a higher guideline range for King than the plea agreement had because it concluded that he was a career offender based on his prior conviction for a drug felony and two predicate crimes of violence. It attributed a sentence range for King of 262 to 327 months under U.S.S.G. § 4B1.1, based on a total offense level of 34 and criminal history category VI. King did not object to the PSR's recommendations, and they were accepted by the district court at sentencing. The government moved for a downward departure for King's assistance under U.S.S.G. § 5K1.1. The district court granted the motion and sentenced King to 196 months in prison.
King appealed, but the government's motion to dismiss was granted on the basis of the appeal waiver in his plea agreement. King then moved the district court to vacate his sentence under 28 U.S.C. § 2255. While he conceded that his prior drug felony qualified as a career offender predicate, King argued pro se that U.S.S.G. § 4B1.1 did not apply because the predicate offenses termed crimes of violence had been incorrectly treated under the guideline grouping rule and neither met the definition of a "prior felony conviction[]" under the career offender guideline. He also maintained that his lawyer had been unconstitutionally ineffective for failing to challenge the application of the career offender guideline at sentencing.
The district court denied King relief, but granted a certificate of appealability "on the issue of ineffective assistance of counsel as it relates to movant's career offender status for sentencing purposes." As no material facts are disputed, we review de novo the district court's denial of King's § 2255 petition. United States v. Martinez-Salinas, 573 F.3d 595, 598 (8th Cir. 2009) (per curiam).

II.
When a criminal defendant has qualifying felonies involving drugs or violence, the sentencing guidelines consider him a "career offender" and call for an enhanced base offense level and criminal history category of VI. The career offender guideline, U.S.S.G. § 4B1.1, provides:
A defendant is a career offender if (1) the defendant was at least eighteen years old at the time the defendant committed the instant offense of conviction; (2) the instant offense of conviction is a felony that is either a crime of violence or a controlled substance offense; and (3) the defendant has at least two prior felony convictions of either a crime of violence or a controlled substance offense.
U.S.S.G. Manual § 4B1.1(a) (2005).
Not all crimes of violence or drug felonies count as predicates under § 4B1.1, however. Section 4B1.2(c) instructs that "[t]he term `two prior felony convictions' means . . . the sentences for [the prior felonies] are counted separately under the provisions of § 4A1.1(a), (b), or (c)," which govern the calculation of a defendant's criminal history category. Thus, "[t]o qualify as a `prior felony' for career offender purposes, the felony must receive criminal history points under subsection (a), (b), or (c) of [§] 4A1.1." United States v. Peters, 215 F.3d 861, 862 (8th Cir.2000) (citing U.S.S.G. § 4B1.2(c)).
The dispute between the parties here grows out of the way the guidelines assign criminal history points to groups of related prior sentences. If a defendant's prior offenses were committed on the same *849 occasion or consolidated for trial or sentencing, "they are deemed related cases under the sentencing guidelines and `are to be treated as one sentence for purposes of § 4A1.1(a), (b), and (c).'" Id. at 862-63 (quoting U.S.S.G. § 4A1.2(a)(2)). Because § 4A1.1 assigns criminal history points based on the length of a prior sentence, however, the question arises here about which sentence should be counted among several related offenses consolidated for sentencing.
Section 4A1.2(a)(2) provides the grouping rule. In order to determine which subsection of § 4A1.1 a group of related prior sentences falls under, we "[u]se the longest sentence of imprisonment if concurrent sentences were imposed and the aggregate sentence of imprisonment imposed in the case of consecutive sentences." U.S.S.G. § 4A1.2(a)(2).
Each of King's disputed career offender predicates was in a group of related offenses which had been sentenced together and then were given a single criminal history point in the PSR under § 4A1.1(c). King argues that in each group, the criminal history point should have properly been attributed to an offense which was not a career offender predicate. If the point had been correctly assigned in each group, he argues, his convictions for resisting arrest would not have received any under § 4A1.1(a), (b), or (c). Consequently those offenses would not trigger the career offender guideline as "`prior felonies' within the meaning of the guidelines." Peters, 215 F.3d at 863.
According to the PSR, King was sentenced in state court on April 1, 2005 on two groups of convictions. The first group had four counts: (1) trafficking drugs in the second degree; (2) unlawful use of a weapon; (3) resisting or interfering with arrest; and (4) third degree assault on a law enforcement officer. He received a ten year suspended sentence for the drug trafficking charge to run concurrently with four year suspended sentences on the second and third charges and a one year suspended sentence on the fourth.
The PSR grouped these four sentences together and assigned one criminal history point to the group under § 4A1.1(c). The parties agree that these sentences are "related" and that the only count in the group that could potentially serve as a predicate under § 4B1.1 is the conviction for resisting arrest. According to § 4A1.2(a)(2), however, the drug trafficking sentence should receive the criminal history point for this group because it was the longest. That offense was not a qualifying felony for career offender purposes under § 4B1.1.[2] Since the resisting arrest charge did not receive a criminal history point, King argues, it cannot be a predicate for § 4B1.1.
King's other potential career offender predicate presents a similar situation. Also on April 1, 2005, King was sentenced on another group of three counts: (1) possession of a controlled substance (cocaine base); (2) resisting or interfering with arrest; and (3) possession of marijuana. He received concurrent suspended sentences of four years for the first two counts and *850 one year for the third. Once again these sentences are related for purposes of calculating criminal history points, and only the resisting arrest charge could potentially qualify as a predicate felony under § 4B1.1. Since King received equivalent suspended sentences for the first and second counts in respect to this group, it is unclear which should receive a criminal history point. Either both of them are "the longest sentence of imprisonment," § 4A1.2(a)(2), or neither is. King argues that under the rule of lenity we should ascribe the criminal history point in this group to the nonpredicate offense and conclude that the resisting arrest conviction in count two does not serve as a predicate under § 4B1.1.
After considerable study, we conclude that King's reading of the guidelines is plausible. It is consistent with the language of §§ 4B1.2(c) and 4A1.2(a)(2) and also finds support in the structure of § 4A1.1. Section 4A1.1(f) presumes that some prior felonies may not receive points under subsections (a), (b), or (c), for the purpose of the former guideline section is to add criminal history points for crimes of violence which escape application of the latter subsections because of the grouping of related offenses.
Under § 4A1.1(f), one criminal history point must be added "for each prior sentence resulting from a conviction of a crime of violence that did not receive any points under (a), (b), or (c) . . . because such sentence was considered related to another sentence resulting from a conviction of a crime of violence. . . ." U.S.S.G. § 4A1.1(f) (2005); see also id. n. 6; United States v. Charles, 209 F.3d 1088, 1091 (8th Cir.2000). Implicit in this provision is the core premise of King's argumentthat not every offense within a group of related prior sentences necessarily "receive[s]" the points ascribed to the group under subsections (a)-(c). Section 4A1.1(f) thus supports the proposition that a potential career offender predicate can be subsumed within a group of convictions which includes a nonpredicate offense that received a longer sentence and therefore earned the designated criminal history point.
Indeed, the government agreed at oral argument on this appeal that if King's resisting arrest convictions had received points under § 4A1.1(f), they would not count as predicates under § 4B1.1. King did not receive points under subsection (f), however, because in 2005(1) that provision only applied where a crime of violence was related to another crime of violence (neither of which King's was) and (2) that provision exempted offenses committed on the same occasion as others (like King's). See U.S.S.G. Manual § 4A1.1(f) (2005).[3] Since subsection (f) did not apply, the government insists that the points assigned the two groups of related offenses under subsection (c) must be attributed to King's resisting arrest convictions. This assumes that a prior felony must receive points either under subsection (f) or under subsections (a), (b), or (c), but nothing in § 4A1.1 or the other guidelines applicable to King establishes that binary framework.
We have previously recognized that "where prior convictions . . . are to be treated as one sentence for purposes of section 4A1.1(a)-(c), it is not clear whether the individual convictions receive criminal history points." United States v. Ruhaak, *851 49 Fed.Appx. 656, 657 (8th Cir.2002) (unpublished per curiam) (citing Peters, 215 F.3d at 862-63). This concern can bring the rule of lenity into play because "[w]here there are two plausible readings of a guideline provision, we apply the rule of lenity and give the defendant the benefit of the reading that results in the shorter sentence." United States v. Oetken, 241 F.3d 1057, 1060 (8th Cir.2001).
The government offers several arguments against King's reading of the guidelines. First, it points to U.S.S.G. § 4A1.2(c), which provides that "[s]entences for all felony offenses are counted." According to the government, that provision means that even when related sentences are treated as one for the purpose of calculating criminal history points, each individual sentence can stand alone for purposes of the career criminal guideline. Several considerations undermine this argument. First, the government's reading is at odds with the implicit logic of § 4A1.1(f) which has already been addressed. Second, § 4A1.2(c), entitled "Sentences Counted and Excluded," enumerates a number of misdemeanors and petty offenses which are not to be counted in a defendant's criminal history. In its context, the natural reading of the section's provision that "all felony offenses are counted" is that it simply serves to distinguish felonies from misdemeanors.
Most fundamentally, the generality of § 4A1.2(c) is not useful in deciding the issue before us. Certainly all felonies are "counted" in the sense that they are subject to the rules for calculating criminal history. But the relevant question here is how a felony is counted within that framework specifically, whether it receives points under § 4A1.1 (a), (b), or (c). Section 4A1.1 presumes, and our precedent recognizes, that some crimes will not be counted under one of those subsections. See Peters, 215 F.3d at 863 (prior convictions assigned points under subsection (f) would "not receive criminal history points under section 4A1.1 (a), (b), or (c)"). The government's reliance on § 4A1.2(c) is thus not persuasive.
The government also urges us to depart from the logic of our Peters decision and to embrace that of a district court in Kentucky. In United States v. Clark, 227 F.Supp.2d 693 (W.D.Ky.2002), the defendant argued that he should not be sentenced as a career offender because one of his predicate felonies had received a point under U.S.S.G. § 4A1.1(f), rather than subsections (a), (b), or (c). Id. at 694. Although the court acknowledged that the defendant's reading of the guidelines was correct, it "decline[d] to adopt such a hyper-technical reading of the definition of `prior felony convictions.'" Id. We cannot agree with that approach. The definition of "prior felony convictions" is clear and simple, at least insofar as it includes only those that receive a point under § 4A1.1(a), (b), or (c). U.S.S.G. § 4B1.2(c); Peters, 215 F.3d at 862. Moreover, Clark is at odds with the government's own reading of the guidelines, for, as mentioned above, the government agrees that a conviction which receives points under subsection (f) is not a predicate under § 4B1.1.[4]
Finally, the government contends that it would frustrate congressional intent not to sentence King as a career *852 offender, pointing to the provision in 28 U.S.C. § 994(h) that the Sentencing Commission should "assure that the guidelines specify a sentence . . . at or near the maximum term authorized" for offenders with multiple prior violent crimes or drug felonies. Section 994(h) provides little guidance, however, for it simply returns us to the question of what prior offenses count within the specific rules of the guidelines. Those are the rules with which we must work, and our deeply rooted tradition in the realm of criminal law is to apply the law strictly as written. United States v. Wiltberger, 18 U.S. (5 Wheat.) 76, 95-96, 5 L.Ed. 37 (1820) ("The rule that penal laws are to be construed strictly, is perhaps not much less old than construction itself."). We are unable to conclude that the government's reading of § 4B1.1 is clearly correct, and "where text, structure, and history fail to establish that the Government's position is unambiguously correct[,] we apply the rule of lenity and resolve the ambiguity in [the defendant's] favor." United States v. Granderson, 511 U.S. 39, 54, 114 S.Ct. 1259, 127 L.Ed.2d 611 (1994).
Because a conviction is not a "prior felony" within the meaning of § 4B1.1 unless it "receive[s] criminal history points under subsection (a), (b), or (c) of [§] 4A1.1," Peters, 215 F.3d at 862, and because it is uncertain whether King's convictions for resisting arrest received points under one of those subsections, we apply the rule of lenity and give him the benefit of the reading which results in a shorter sentence. Oetken, 241 F.3d at 1060. Accordingly, we conclude that the district court erred in sentencing King under § 4B1.1.

III.
The question remains whether, having shown his sentence was erroneously imposed, King is entitled to the relief he seeks. 28 U.S.C. § 2255 provides a federal prisoner an avenue for relief if his "sentence was imposed in violation of the Constitution or laws of the United States, or. . . was in excess of the maximum authorized by law." 28 U.S.C.A. § 2255(a) (West Supp.2009). King cannot obtain relief on the basis of the guideline error alone, however, because he waived the right to bring all § 2255 claims except claims of ineffective assistance of counsel or prosecutorial misconduct. We have recognized in any case that "ordinary questions of guideline interpretation" are not remediable on a § 2255 motion unless the error rises to the level of being a miscarriage of justice. Auman v. United States, 67 F.3d 157, 161 (8th Cir.1995). This case does not rise to that extraordinary level.
King maintains, however, that he was denied the effective assistance of counsel guaranteed by the Sixth Amendment when his lawyer failed to challenge the application of § 4B1.1 at sentencing. If he is correct, then his sentence was imposed "in violation of the Constitution," § 2255(a), and he is entitled to relief. In order to make out his claim of ineffective assistance, King must satisfy the familiar standard of Strickland v. Washington, 466 U.S. 668, 104 S.Ct. 2052, 80 L.Ed.2d 674 (1984), which requires a showing "that his lawyer's performance fell below the minimum standards of professional competence (deficient performance) and that there is a reasonable probability that the result of the proceedings would have been different if his lawyer had performed competently (prejudice)." Alaniz v. United States, 351 F.3d 365, 367-68 (8th Cir.2003) (citing Strickland, 466 U.S. at 690, 694, 104 S.Ct. 2052).
There can be little doubt that King suffered prejudice from his lawyer's error. Had his argument been presented to the district court at sentencing, King likely would have received a much shorter sentence, *853 and "[a]n error increasing a defendant's sentence by as little as six months can be prejudicial within the meaning of Strickland." Id. at 368 (citing Glover v. United States, 531 U.S. 198, 202-04, 121 S.Ct. 696, 148 L.Ed.2d 604 (2001)).
We would be reluctant to conclude that King's attorney was unconstitutionally ineffective for failing to raise his guideline argument at sentencing, for "we must `judge the reasonableness of counsel's challenged conduct on the facts of the particular case, viewed as of the time of counsel's conduct.' . . . The standard is highly deferential." Ruff v. Armontrout, 77 F.3d 265, 268 (8th Cir.1996) (quoting Strickland, 466 U.S. at 690, 104 S.Ct. 2052). That we now conclude King's argument prevails does not necessarily mean his attorney was incompetent for failing to pursue it. See, e.g., Anderson v. United States, 393 F.3d 749, 754 (8th Cir.2005) (counsel was not ineffective for failing to raise an argument which "may have had merit," but which was "a wholly novel claim at the time").
We conclude that King is entitled to relief for a different reasonhis appellate attorney's performance cost him the opportunity to present his meritorious argument on direct appeal. King pressed his guideline argument in a pro se supplemental brief on direct appeal, but it was never addressed. His appeal was dismissed based on the waiver of direct appeal rights in his plea agreement. That waiver should not have been enforced, however, because it was conditioned upon King being sentenced according to the agreed upon sentencing recommendations contained in the plea agreement, and he was not. By not raising this issue (and by failing to pick up on King's guideline argument even though it was advanced in his pro se filings) King's lawyer failed to provide the effective assistance of counsel guaranteed by the Constitution.
"Plea agreements are essentially contracts between the defendant and Government," United States v. Andis, 333 F.3d 886, 890 (8th Cir.2003) (en banc), and in construing them we seek "the intent of the parties as expressed in the plain language of the agreement when viewed as a whole," United States v. Martinez-Noriega, 418 F.3d 809, 815 (8th Cir.2005). It is evident from the language of King's plea agreement that the waiver of his right to appeal sentencing issues would only have force "[i]n the event the [district] Court. . . applie[d] the recommendations agreed to by the parties herein." Those recommendations included a specific guideline and offense level under § 2D1.1, which the district court rejected at sentencing, stating that "[t]he parties had recommended that there be a total offense level of 29 and I think that was an accurate analysis were it not for the fact that on analysis of the defendant's criminal history it appears that he became what we call a career offender under Section 4B1.1."
Because the district court did not apply the sentencing recommendations contained in King's plea agreement, the agreement's plea waiver had no force. See Restatement (Second) of Contracts § 225(1) ("Performance of a duty subject to a condition cannot become due unless the condition occurs . . . ."); cf. United States v. McIntosh, 492 F.3d 956, 959 (8th Cir.2007) (enforcing conditional waiver of appeal where "the district court applied each of the specific recommendations" in the plea agreement).
When the government sought to enforce the appeal waiver, King's attorney resisted with a boilerplate argument attacking the voluntariness of the agreement. He did not offer the obvious and meritorious argument based on the plain language of the *854 agreement. We conclude that his failure to do so deprived King of the effective assistance of counsel guaranteed by the Constitution.
King did not raise this argument before the district court or on appeal. Nevertheless, the "Supreme Court and this court have recognized in criminal cases that appellate courts can examine a critical issue affecting substantial rights sua sponte under Fed.R.Crim.P. 52(b)." United States v. Granados, 168 F.3d 343, 345-46 (8th Cir.1999) (per curiam) (in appeal from denial of § 2255 motion, granting relief sua sponte because of ineffective assistance of counsel at sentencing). Under Rule 52(b), we may grant relief where there has been "(1) error, (2) that is plain,. . . (3) that affects substantial rights," and (4) that "seriously affects the fairness, integrity, or public reputation of judicial proceedings." United States v. Lovelace, 565 F.3d 1080, 1090 (8th Cir.2009).
The dismissal of King's direct appeal on the basis of an unenforceable waiver was plain error. See id. at 1092 ("A plain error is one that is clear or obvious under current law."). Furthermore, "[t]here can be little doubt that the petitioner's substantial rights are affected if his prison sentence is longer than it should have been." Granados, 168 F.3d at 346. But for the failure of King's counsel, the court would have reached the merits of his argument. Since we now conclude that argument succeeds, it follows that there is a strong probability that "but for the error he would have received a more favorable sentence." Lovelace, 565 F.3d at 1092.
Finally, we afford relief only where a plain error "seriously affects the fairness, integrity or public reputation of judicial proceedings." Id. King received a sentence many years beyond the correct guideline range. He advanced pro se a meritorious argument which his lawyer ignored, and his appeal was summarily dismissed for an improper reason. The error seriously affected the fairness and integrity of the proceedings, and we therefore find it proper to grant the relief King seeks.[5]

IV.
For the foregoing reasons, we vacate Johnnie King's sentence and remand to the district court for resentencing not involving application of U.S.S.G. § 4B1.1.
NOTES
[1]  The Honorable Lyle E. Strom, United States District Judge for the District of Nebraska, sitting by designation.
[2]  The drug trafficking offense in this first group and the conviction for possession of crack in the second group cannot count as "controlled substance offenses" within the meaning of § 4B1.1 because that term only includes crimes which involve actual or intended "manufacture, import, export, distribution, or dispensing of a controlled substance." U.S.S.G. § 4B1.2(b). According to the PSR, King's drug offenses sentenced on April 1, 2005 only involved possession. See United States v. Walterman, 343 F.3d 938, 940 (8th Cir.2003) ("[E]ach of the referenced acts [in § 4B1.2(b)] requires something more than just possession.").
[3]  Subsection (f) has since been amended so that if King were sentenced under the current guidelines, it would apply to him. See U.S.S.G. Manual § 4A1.1(f) (2009) ("Add 1 point for each prior sentence resulting from a conviction of a crime of violence that did not receive any points under (a), (b), or (c) above because such sentence was counted as a single sentence.").
[4]  The government also cites an unpublished per curiam decision from the Fourth Circuit, United States v. Slade, No. 09-4262, 2009 WL 3287580 (4th Cir. Oct.13, 2009). The brief analysis there provides limited guidance. Moreover, it is inapposite because in that case the related prior convictions had received consecutive sentences, not concurrent ones. Id. at * 2.
[5]  The government argues that our review is limited to the issues specified in the certificate of appealability, which did not include the ineffectiveness of King's appellate counsel. While that is ordinarily true, de la Garza v. Fabian, 574 F.3d 998, 1001 (8th Cir.2009), we retain "discretion to consider sua sponte issues beyond those specified in a certificate of appealability," United States v. Morgan, 244 F.3d 674, 674-75 (8th Cir.2001) (en banc). We think it appropriate to expand the certificate in this case, particularly because King filed his § 2255 motion pro se and the issues were therefore not presented to the district court as clearly as they might have been.
