
606 F.3d 969 (2010)
UNITED STATES of America, Appellee,
v.
Rickey J. MILLER, Appellant.
No. 09-1246.
United States Court of Appeals, Eighth Circuit.
Submitted: January 15, 2010.
Filed: June 8, 2010.
*970 Lucille Gardner Liggett, AFPD, St. Louis, MO, for appellant.
Antoinette Decker, AUSA, St. Louis, MO, for appellee.
Before MELLOY, SMITH, and COLLOTON, Circuit Judges.
COLLOTON, Circuit Judge.
Rickey Miller pleaded guilty to one count of conspiracy to possess with intent to distribute methylenedioxyamphetamine (also known as "MDMA" or "Ecstasy"), in violation of 21 U.S.C. §§ 841(a)(1) and 846. The district court[1] sentenced Miller to a term of 180 months' imprisonment, which was within the advisory guideline range determined by the court. Miller appeals, arguing that the district court failed adequately to explain its sentence and imposed a substantively unreasonable sentence. Because we conclude that Miller knowingly and voluntarily waived his right to appeal on these grounds, we dismiss the appeal.

I.
A grand jury indicted Miller in December 2007 on one count of conspiracy to possess with intent to distribute MDMA, in violation of 21 U.S.C. §§ 841(a)(1) and 846. On October 31, 2008, Miller pleaded guilty pursuant to a written plea agreement. During Miller's change of plea hearing, the district court engaged Miller in a colloquy concerning the agreement, including the appeal waiver provision contained therein. The court explained to Miller that if the court chose to "follow the recommendations" and "sentence [him] consistent with [his] plea agreement," then Miller "agreed not to appeal the sentence." Miller acknowledged that he understood the waiver provision, and his counsel pointed out that Miller had retained his "right to appeal any criminal history category." The district court confirmed that there was "no agreement" as to how Miller's criminal history should be scored.
The plea agreement did not specify a criminal history category, but the parties did jointly recommend a total offense level of thirty-four under the advisory guidelines. The presentence report recommended *971 a total offense level of thirty-four and a criminal history category of III, based on Miller's prior convictions and probationary status at the time of the instant offense. These calculations resulted in an advisory guideline sentencing range of 188-235 months. Miller did not object to the recommended total offense level.
At a sentencing hearing in January 2009, Miller moved for a downward departure under § 4A1.3 of the advisory guidelines, arguing that a criminal history category of III overstated the seriousness of his prior misdemeanor convictions. The government opposed the motion. The district court agreed with Miller, finding that a criminal history category of II was more appropriate. This departure resulted in an advisory guideline range of 168-210 months' imprisonment.
Miller also urged the court to sentence below the advisory guidelines based on 18 U.S.C. § 3553(a), citing, among other factors, his need to support his four children, his substance abuse problem, and his cooperation with law enforcement. The government opposed a variance from the advisory guideline range. The court determined that a sentence of 180 months' imprisonment was appropriate in light of the factors set forth in § 3553(a), and declined to vary from the advisory range.
Miller argues on appeal that the district court committed procedural error by failing adequately to explain its reasoning for denying his request for a downward variance and for imposing a sentence in the middle of the advisory guideline range. Miller also contends that his sentence is substantively unreasonable, because the court did not fully consider the § 3553(a) factors as they apply to him. The government counters that Miller's appeal should be dismissed because of the waiver of rights set forth in the plea agreement. Alternatively, the government argues that the sentence should be affirmed on the merits.

II.
A defendant may waive his right to appeal, and we will enforce a waiver when the issues raised are "within the scope of the waiver," the defendant entered into the agreement and waiver "knowingly and voluntarily," and enforcement of the waiver would not result in a "miscarriage of justice." United States v. Andis, 333 F.3d 886, 889-90 (8th Cir.2003) (en banc).
The waiver provision in Miller's plea agreement states, in relevant part:
In the event the Court accepts the plea and, in sentencing the defendant, 1) applies the recommendations agreed to by the parties herein, and 2) after determining a Sentencing Guideline range, sentences the defendant within that range, then, as part of this agreement, both the defendant and the government hereby waive all rights to appeal all sentencing issues, including any issues relating to the determination of the Total Offense Level. However, the defendant retains his right to appeal his Criminal History Category or status as a Career Offender.
Plea Agreement, R. Doc. 293, at 3 (emphasis added).
The government contends that because the district court applied the sentencing recommendations in the plea agreement, Miller waived the right to appeal "all sentencing issues," including those raised here. Miller, on the other hand, argues that the waiver is unenforceable because the parties disagreed about whether the court should vary from the advisory guideline range and sentence Miller to a shorter term of imprisonment. Without an agreed recommendation on a final sentencing *972 range, Miller asserts, the waiver is inapplicable.
Miller's plea agreement contained five specific sentencing recommendations from the parties, all in a section entitled "Guidelines Recommendations." First, the "parties recommend[ed] that the base offense level is 34," based on the "quantity of MDMA for which the defendant is accountable." Second, Miller and the government agreed that no increase for specific offense characteristics should apply. Third, the parties recommended a three-level increase for Miller's role as a manager or supervisor of criminal activity that involved five or more participants. Fourth, the parties advocated a two-level deduction because "the defendant has clearly demonstrated acceptance of responsibility," plus an additional one-level decrease due to Miller's timely guilty plea. Finally, based on the preceding recommendations, "the parties estimate[d] that the Total Offense Level is 34."
The plea agreement omitted any recommendation as to Miller's criminal history. Instead, the agreement stated that "[t]he determination of the defendant's Criminal History Category shall be left to the Court after it reviews the Presentence Report," and both parties retained their right "to challenge, before sentencing, the finding of the Presentence Report as to the defendant's criminal history and the applicable category." The agreement also made no recommendation regarding a variance from the advisory guideline range based on § 3553(a). The parties agreed instead to "retain their rights to request a sentence above or below the applicable guideline range."
We conclude that the preconditions of Miller's appeal waiver were satisfied, and that the waiver should be enforced. The waiver was binding if the district court applied the recommendations agreed to by the parties in the plea agreement, and if the court sentenced Miller within the advisory guideline range determined by the court. Both requirements were satisfied. The district court applied all five of the sentencing recommendations. And the court sentenced Miller within the advisory guideline range that resulted from those recommendations and the court's determination about criminal history. See USSG § 1B1.1(g).
The parties' disagreement at sentencing regarding a downward departure or a variance from the advisory range does not preclude enforcement of the waiver. The agreement contained no recommendation regarding either issue, and the waiver was not contingent on the parties reaching agreement on those points. The agreement also did not make application of a particular sentencing range a precondition to Miller's waiver. The parties agreed to disagree about an appropriate criminal history category, and the final advisory range obviously depended on the category determined by the court.
In summary, the district court's application of the five recommendations of the parties contained in the plea agreement, along with a sentence within the advisory guideline range ultimately determined by the court, triggered Miller's waiver of his right to appeal "all sentencing issues," except for his criminal history category. Miller's claims of procedural error and substantive unreasonableness are within the scope of this broad waiver. Miller does not dispute that his waiver was knowing and voluntary, and he does not contend that enforcement of the waiver would result in a miscarriage of justice.
For these reasons, we enforce Miller's waiver of his right to appeal and dismiss the appeal.
NOTES
[1]  The Honorable Rodney W. Sippel, United States District Judge for the Eastern District of Missouri.
