
    Matthew Rowan DAVIES, Petitioner-Appellant, v. Michael BENOV, Respondent-Appellee.
    No. 15-17256
    United States Court of Appeals, Ninth Circuit.
    Argued and Submitted March 15, 2017 San Francisco, California
    Filed May 17, 2017
    
      Cody Harris (argued), Philip J. Tassin, Steven P. Ragland, and Elliot R. Peters, Keker & Van Nest LLP, San Francisco, California, for Petitioner-Appellant.
    
      Gregory T. Broderick (argued), Assistant United States Attorney; Camil A. Skipper, Appellate Chief; Phillip A. Tal-bert, United States Attorney; United States Attorney’s Office, Sacramento, California; for Respondent-Appellee.
    Before: KIM McLANE WARDLAW, RONALD M. GOULD, and CONSUELO M. CALLAHAN, Circuit Judges.
   OPINION

GOULD, Circuit Judge:

Matthew Davies filed a 28 U.S.C. § 2241 habeas corpus petition, contending that a congressional appropriations rider prohibits the Bureau of Prisons (BOP) from using federal funds to incarcerate him and seeking release from custody to remedy the wrongful expenditure. The district court denied his habeas corpus petition, and Davies appealed. Because Davies voluntarily waived his right to bring this challenge through the collateral-attack waiver provision of his plea agreement, we affirm the denial of his habeas corpus petition.

I

Davies owned and operated medical marijuana dispensaries in Stockton and Sacramento, California, which he contends complied with state and local medical marijuana laws. Davies, however, was charged with violating federal drug laws, including manufacturing, distributing, and conspiring to manufacture and distribute marijuana—a Schedule I controlled substance. He subsequently entered into a plea agreement, agreeing to a five-year prison term and pleading guilty to the ten counts filed against him. His plea agreement included a waiver of the rights to bring an appeal or collateral attack on his conviction or sentence. Section VII. B of Davies’s plea agreement reads:

Waiver of Appeal and Collateral Attack: The defendant understands that the law gives him a right to appeal his conviction and sentence. He agrees as part of his plea, however, to give up the right to appeal the conviction and the right to appeal any aspect of the sentence imposed in this case so long as his prison sentence is no longer than 5 years.
Regardless of the sentence he receives, the defendant also gives up any right he may have to bring a post-appeal attack on his conviction or his sentence. He specifically agrees not to file a motion under 28 U.S.C. § 2255 or § 2241 attacking his conviction or sentence.

Davies was sentenced to five years in prison, and is projected to be released on August 9, 2017.

Nearly one year into Davies’s term of imprisonment, Congress enacted an omnibus appropriations bill, which included an appropriations rider requiring that:

None of the funds made available in this Act to the Department of Justice may be used, with respect to the States of Alabama, Alaska, Arizona, California, Colorado, Connecticut, Delaware, District of Columbia, Florida, Hawaii, Illinois, Iowa, Kentucky, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nevada, New Hampshire, New Jersey, New Mexico, Oregon, Rhode Island, South Carolina, Tennessee, Utah, Vermont, Washington, and Wisconsin, to prevent such States from implementing their own State laws that authorize the use, distribution, possession, or cultivation of medical marijuana.

Consolidated and Further Continuing Appropriations Act, 2015, Pub. L. No. 113-235, § 538,128 Stat. 2130, 2217 (2014). The most recent appropriations act appropriates funds through the fiscal year ending on September 30, 2017, and includes essentially the same rider. See Consolidated Appropriations Act, 2017, Pub. L. No. 115-31, § 537 (2017) (additionally listing Arkansas, Georgia, Louisiana, New York, North Carolina, Ohio, Oklahoma, Pennsylvania, Texas, Virginia, West Virginia, Wyoming, Guam, and Puerto Rico and changing “prevent such States from implementing their own State laws” to “prevent any of them from implementing their own laws”). We have held that, “at a minimum, [the appropriations rider] prohibits [the Department of Justice] from spending funds from relevant appropriations acts for the prosecution of individual's who engaged in conduct permitted by the State Medical Marijuana Laws and who fully complied with such laws.” United States v. McIntosh, 833 F.3d 1163, 1177 (9th Cir. 2016); see United States v. Nixon, 839 F.3d 885, 887-88 (9th Cir. 2016) (per curiam).

Davies filed a habeas corpus petition under 28 U.S.C. § 2241 in the Eastern District of California, contending that the BOP’s use of federal funds to incarcerate individuals, such as himself, who engaged in conduct permitted by state medical marijuana laws violates the appropriations rider. Davies argued that his continued imprisonment prevents California from implementing its own state medical marijuana laws, and requested that the court “issue a Writ of Habeas Corpus ordering [Benov] to release Davies from his custody” as the remedy. The magistrate judge denied the petition, holding that the waiver provision in Davies’s plea agreement barred him from bringing the challenge, and the magistrate judge entered judgment in the case. Davies timely appealed.

II

We have jurisdiction pursuant to 28 U.S.C. § 2253. We review the district court’s denial of a habeas corpus petition de novo. Moore v. Reno, 185 F.3d 1054, 1054 (9th Cir. 1999) (per curiam). We review the scope and validity of an appeal waiver de novo. See United States v. Charles, 581 F.3d 927, 931 (9th Cir. 2009).

III

The sole question presented here is whether the plea agreement’s waiver provision clearly bars Davies from bringing his § 2241 petition, which challenges his continued incarceration based on the appropriations rider. The waiver language included in Davies’s plea agreement is broad and unambiguous, and we hold that it precludes Davies’s petition on the grounds he raised.

A defendant’s waiver of his rights to appeal and to bring a collateral attack is generally enforced if “(1) the language of the waiver encompasses his right to appeal on the grounds raised, and (2) the waiver is knowingly and voluntarily made.” United States v. Jeronimo, 398 F.3d 1149, 1153 (9th Cir. 2005), overruled on other grounds by United States v. Jacobo Castillo, 496 F.3d 947, 957 (9th Cir. 2007) (en banc). Principles of contract law control our interpretation of a plea agreement. See United States v. Speelman, 431 F.3d 1226, 1229 (9th Cir. 2005). “We therefore will ‘generally enforce the plain language of a plea agreement if it is clear and unambiguous on its face.’ ” Id. (quoting Jeronimo, 398 F.3d at 1153). The government, as the drafter of this plea agreement, “is responsible for any lack of clarity such that ambiguities are construed in favor of the defendant.” Charles, 581 F.3d at 931.

The direct-appeal waiver provision prevents Davies from “appeal[ing] any aspect of the sentence imposed in this case,” and Davies stresses that the collateral-attack waiver provision does not include the same language. The collateral-attack waiver provision instead states that, “[rjegardless of the sentence he receives, the defendant also gives up any right he may have to bring a post-appeal attack on his conviction or sentence” and that he “specifically agrees not to file a motion under 28 U.S.C. § 2255 or § 2241 attacking his conviction or sentence.” Davies contends that the collateral-attack waiver provision is more limited in scope than the direct-appeal waiver provision because the provision does not preclude an attack on “any aspect of his sentence.”

Davies also seeks to enhance his argument by contending that his § 2241 petition permissibly challenges the execution of the sentence—because the BOP’s expenditure of funds to incarcerate him unlawfully contravenes the appropriations rider—and does not challenge the legality of the sentence itself. Davies argues that a ruling .in his favor would merely have “the ancillary effect of ending his present incarceration,” that the grant of the petition would leave all other aspects of his sentence untouched because he is not asking that his sentence be vacated, and that he would “continue to suffer all of the effects” of a felony conviction.

Despite differences in the language of the direct-appeal and collateral-attack waiver provisions, the collateral-attack waiver provision states the scope of the waiver: Davies gives up any right to bring a post-appeal attack on his' conviction or sentence. The scope of the collateral-attack waiver provision clearly covers his present challenge. Limitations on any right to attack his sentence encompasses challenges to the execution and conditions of his sentence, as his challenge is styled here, as well as to the legality of his sentence.

The collateral-attack waiver provision’s limitations on the method of collaterally attacking a sentence further precludes Davies’s 28 U.S.C. § 2241 petition. Davies has waived his right to challenge the BOP’s expenditure of funds to execute his sentence by specifically agreeing to not file a § 2241 petition to collaterally attack his sentence.

Davies broadly waived his right to challenge his sentence in the manner raised, as the waiver encompasses the execution of his sentence, and he specifically waived his right to do so through a § 2241 petition.

IV

The collateral-attack waiver provision in Davies’s plea agreement bars him from this particular challenge to the BOP’s use of federal funds to incarcerate him for conduct he contends complied with California’s medical marijuana laws. Because of this waiver, we need not reach and save for another day the issue of whether the expenditure of federal funds to incarcerate individuals who fully complied with state medical marijuana laws violates the appropriations rider. Cf. McIntosh, 833 F.3d at 1177-78 (holding that the appropriations rider prohibits the Department of Justice from using appropriated funds to prosecute individuals for engaging in conduct permitted by state medical marijuana laws). “We will enforce a valid waiver even if the claims that could have been made [through a collateral attack] absent that waiver appear meritorious, because the whole point of a waiver is the relinquishment of claims regardless of their merit.” United States v. Medina-Carrasco, 815 F.3d 457, 462-63 (9th Cir. 2015) (internal quotation marks, alterations, and emphasis omitted). We affirm the district court’s denial of Davies’s petition for writ of habe-as corpus.

AFFIRMED. 
      
      . California passed the Compassionate Use Act of 1996 “[t]o ensure that seriously ill Californians have the right to obtain and use marijuana for medical purposes” and “that patients and their primary caregivers who obtain and use marijuana for medical purposes upon the recommendation of a physi-cían are not subject to criminal prosecution or sanction.” Cal. Health & Safety Code § 11362.5(b)(1)(A), (B). California’s Medical Marijuana Program creates a regulatory scheme for the cultivation, distribution, and use of medical marijuana. See id. § 11362.7 et seq.
      
     
      
      . Claims that the plea or waiver itself was involuntary or that ineffective assistance of counsel rendered the plea or waiver involuntary, however, may not be waived. See Washington v. Lampert, 422 F.3d 864, 871 (9th Cir. 2005) (“[A] plea agreement that waives the right to file a federal habeas petition pursuant to 28 U.S.C. § 2254 is unenforceable with respect to an [ineffective assistance of counsel] claim that challenges the voluntariness of the waiver.”). Here, however, the parties do not dispute that Davies knowingly and voluntarily entered into the plea agreement. The parties dispute what exactly Davies waived through the collateral-attack waiver provision.
     
      
      . The parties disagree as to whether Davies’s distribution of medical marijuana complied with California laws requiring that distribution be done on a non-profit basis, that Davies be a primary caregiver, and that his dispensaries operate as collectives.
     