Travis Elliott pled guilty to participating in a drug conspiracy. In his plea agreement, Elliott waived the right to appeal his conviction and sentence. After the co-defendant was acquitted of the conspiracy charge to which Elliott had pled guilty, Elliott moved to withdraw his guilty plea. The district court denied the motion. Elliott appeals, notwithstanding the appeal waiver. We exercise jurisdiction under 28 U.S.C. § 1291 and DISMISS on the ground that Elliott validly waived his right to contest his conviction on appeal.
BACKGROUND
Travis Elliott, a.k.a. “T-Rock,” pled guilty to one count of conspiracy to possess with intent to distribute and to distribute controlled substances in violation of 21 U.S.C. § 846. Pursuant to his plea agreement, filed with the district court August 27, 1999, Elliott “knowingly and expressly waive[d] the right to contest his conviction and sentence for [this charge] in any direct or collateral appeal or other post-conviction action, including any proceeding under *117328 U.S.C. § 2255.” In return, the Government agreed not to charge Elliott with other crimes related to the larger drug conspiracy, and it also agreed to recommend certain sentence reductions under the Sentencing Guidelines. At the time the court accepted Elliott’s plea, the magistrate probed Elliott’s waiver of appellate rights and obtained several statements from Elliott that the waiver Was knowingly and voluntarily given.
Sidney Iiland, Elliott’s alleged co-conspirator, proceeded to trial on numerous charges, including conspiring with Elliott to distribute drugs. Before the case was submitted to the jury, the trial court granted Eland’s motion for acquittal on the charge that he conspired with Elliott. See Fed.R.Crim.P. 29(a) (motion for acquittal). The jury subsequently found Iiland guilty of other federal drug trafficking crimes.
On October 26, 1999, Elliott moved to withdraw his guilty plea on the ground that it lacked a factual basis. See Fed. R.Crim.P. 32(e) (“[T]he court may permit the plea to be withdrawn if the defendant shows any fair and just reason.”). Relying on the seven factors articulated in United States v. Gordon, 4 F.3d 1567, 1572 (10th Cir.1993), the district court denied Elliott’s motion. The court sentenced Elliott to sixty months imprisonment, the statutory minimum.
DISCUSSION
Elliott appeals the court’s denial of his motion to withdraw his guilty plea. The Government responds that Elliott waived his right to appeal. We agree.
“A defendant’s knowing and voluntary waiver of the statutory right to appeal his sentence is generally enforceable.” United States v. Hernandez, 134 F.3d 1435, 1437 (10th Cir.1998). “Nevertheless, a defendant who waives his right to appeal does not subject himself to being sentenced entirely at the whim of the district court.” United States v. Black, 201 F.3d 1296, 1301 (10th Cir.2000) (citation omitted). Appellate waivers are subject to certain exceptions, including where the district court relied on an impermissible factor such as race, where ineffective assistance of counsel in connection with the negotiation of the waiver renders the waiver invalid, where the sentence exceeds the statutory maximum, or where the waiver is otherwise unlawful. See United States v. Cockerham, 237 F.3d 1179, 1182 (10th Cir.2001). We have enforced waivers of the right to appeal the imposition of a sentence, see Hernandez, 134 F.3d at 1437-38, and waivers of the right collaterally to attack under 28 U.S.C. § 2255 a defendant’s conviction or sentence, see Cockerham, 237 F.3d at 1183. This case asks us to consider whether a defendant may waive his right to direct appeal of a conviction. We see no material difference between waiving this right and waiving other rights to appeal, so we conclude we must enforce the waiver and dismiss this appeal.
This conclusion is supported by other circuits and sound public policy. See United States v. Michelsen, 141 F.3d 867, 869-73 (8th Cir.1998) (upholding a district court’s dismissal of a defendant’s appeal from a magistrate judge’s ruling on the ground that the defendant had executed a valid waiver of his right to appeal his conviction and sentence); United States v. Michlin, 34 F.3d 896, 901 (9th Cir.1994) (dismissing appeal of the district court’s denial of defendants’ motion to withdraw their guilty pleas because defendants had waived the right to appeal their convictions); United States v. Davis, 954 F.2d 182, 185-86 (4th Cir.1992) (enforcing defendant’s waiver of his right to appeal prior convictions).
*1174“[Pjublic policy strongly supports plea agreements that include an appeal waiver.” United States v. Littlefield, 105 F.3d 527, 530 (9th Cir.1997) (Hall, J., concurring). “A waiver of appellate rights can be of great value to an accused as a means of gaining concessions from the government....” Michelsen, 141 F.3d at 873. Appeal waivers also benefit the government by saving them the time and money involved in arguing appeals. Cf. Littlefield, 105 F.3d at 530 (Hall, J., concurring) (“Only through the dismissal of this appeal will the government receive the benefit of its bargain.”). Society benefits from the finality that waivers bring. See United States v. Baramdyka, 95 F.3d 840, 843 (9th Cir.1996) (“Th[e] proper enforcement of appeal waivers serves an important function in the judicial administrative process by preserving the finality of judgments and sentences imposed pursuant to valid plea agreements.”) (alterations omitted). “In order to preserve their value [to defendants, to the government, and to society], such waivers must be accorded their proper effect.” Michelsen, 141 F.3d at 873.
Applying this understanding to this case, we note at the outset that Elliott does not allege that he did not knowingly and voluntarily accept the appellate waiver,1 that counsel was ineffective in connection with the negotiation of the waiver, that the waiver is otherwise unlawful, or that any other recognized exception to enforcing waivers exists. Rather, Elliott argues that the waiver does not bar him from challenging the factual basis for — and, thus, the validity of — the guilty plea. We agree he can contest his conviction by challenging the guilty plea, but only at the district couH level. What his waiver forecloses is appealing the district court’s decisions regarding his conviction and sentence, including its denial of Elliott’s motion to withdraw his plea.
Case law makes clear that an appeal of a denial of a motion to withdraw a guilty plea is an attempt to “contest a conviction on appeal,” and thus falls within the plain language of the waiver provision. See Michlin, 34 F.3d at 897-98, 901 (waiver of right to appeal conviction also precludes appeal of denial of motion to withdraw guilty plea); United States v. Hernandez, 242 F.3d 110, 113 (2d Cir.2001) (concluding that the defendant’s appeal of the denial of the motion to withdraw his guilty plea was “an issue related to the merits of the underlying conviction,” and suggesting, in dicta, that had the waiver agreement included a waiver of the right to appeal the conviction, it would have precluded appeal of a denial of the motion to withdraw the guilty plea); United States v. Morrison, 171 F.3d 567, 568 (8th Cir.1999) (forbidding appeal from district court’s denial of leave to withdraw plea on the ground that the defendant had waived the right to appeal). To allow Elliott to appeal the denial of his motion to withdraw his plea (for reasons other than those articulated in Cockerham, 237 F.3d at 1182) would be to allow Elliott to render a sham his promise not to “contest his conviction and sentence in any direct or collateral appeal” and would deprive the government of the benefit of its bargain, for which it rendered valuable consideration to Elliott. Accord United States v. Wenger, 58 F.3d 280, 282 (7th Cir.1995) (“Empty promises are worthless promises; if defendants could retract their waivers ... then they could not obtain concessions by promising not to *1175appeal. Although any given defendant would like to obtain the concession and exercise the right as well, prosecutors cannot be fooled in the long run. Right holders are better off if they can choose between exercising the right and exchanging that right for something they value more highly. Wenger exchanged the right to appeal for prosecutorial concessions; he cannot have his cake and eat it too.”) (citation omitted).
Elliott further argues that his “plea attack was not an attack on a conviction because he had not been convicted and was not an attack of the sentence because he had not been sentenced.” Even assuming, without deciding, that when he attacked his plea in the district court he had not yet been convicted or sentenced, Elliott has since been both convicted and sentenced, and this appeal is an attempt to “contest his conviction ... in [a] direct ... appeal.” As such, it falls squarely within the language of the waiver provision to which both Elliott and the government agreed. In short, Elliott’s appellate waiver left him free to challenge his conviction and sentence at the district court level but barred direct or collateral appeals.
We also reject the argument that the waiver is invalid because the district court at sentencing erroneously stated that Elliott had a right to appeal: “Mr. Elliott, you have the right to appeal the judgment and sentence of this Court to the Tenth Circuit Court of Appeals.” This avenue is foreclosed by our decision in Black, where we held that an even more explicit statement by a district court at the time of sentencing, to wit, “I am going to strike that provision of the plea agreement so that you may appeal,” did not modify the earlier plea agreement and invalidate the waiver. See Black, 201 F.3d at 1303 (“[B]ecause the district court’s remarks at sentencing could not have affected [the defendant’s] decision to enter into the plea agreement and waive his right to appeal, and because the district court lacked the authority to modify the plea agreement in theses circumstances, we conclude that the waiver-of-appeal provision should be enforced.”). Elliott has never argued that he was misled by the district court’s statement at sentencing to his detriment. Indeed, Elliott could not have relied upon this statement when agreeing to waive his appellate rights because the waiver was negotiated and agreed to long before this erroneous remark was given by the court at the time of sentencing. Accord United States v. Atterberry, 144 F.3d 1299, 1301 (10th Cir.1998) (agreeing with “the circuits that have held statements made by a judge during sentencing concerning the right to appeal do not act to negate written waivers of that right, because statements like those made by the court during [the defendant’s] sentencing do not affect a defendant’s pri- or decision to plead guilty and waive appellate rights”). And, notwithstanding this remark, Elliott did not, at that time, seek to withdraw his guilty plea or void his waiver on the ground that he had intended to preserve his appeal rights.
Finally, we find Elliott’s reliance on United States v. Tang, 214 F.3d 365 (2d Cir.2000), misplaced. In Tang, the Second Circuit reiterated the rule that the district court must determine whether a defendant understands and voluntarily enters into any waiver of rights to appeal. See id. at 368 (citing Fed.R.Crim.P. 11(c)(6)). As noted above, the magistrate judge complied with this rule.
CONCLUSION
Having found the appellate waiver valid and this appeal falling within its plain language, we enforce it and DISMISS.
. Indeed, the plea agreement, which he signed, stated that Elliott "knowingly and expressly waive[d] the right” to appeal. Furthermore, at the change-of-plea hearing, the magistrate judge explained to Elliott that his plea agreement contained "waivers and stipulations,” and Elliott responded affirmatively to the magistrate’s questions regarding whether he understood and desired to enter into the agreement.