Leonard Vignolo, a Nevada state prisoner, appeals from the district court’s order dismissing his 42 U.S.C. § 1983 action for failure to state a claim. The district court had jurisdiction under 28 U.S.C. § 1343(a)(3). We have jurisdiction over this timely appeal pursuant to 28 U.S.C. § 1291. We reverse the dismissal and remand for further proceedings.
I
The Nevada Department of Prisons has a “fiscal agreement” which governs the financial relationship between certain inmates and the prison. Among other things, that agreement describes how the prison will credit wages to various inmate accounts, and authorizes payroll deductions for taxes, room and board, prison construction, and a victim’s compensation fund. Under institutional procedures in effect until January 10, 1994, an inmate was required to sign a fiscal agreement if he received over eighteen dollars in weekly gross wages from prison employment.
In 1991, Vignolo began working in the law library at Ely State Prison in Ely, Nevada. His salary was twenty dollars a month, and while working he received ten work day credits per month. Because his wages fell below the eighteen dollar per week threshold, he was not required to sign a fiscal agreement.
In 1993, another inmate at the Ely State Prison successfully sued the Department of Prisons for failing to credit the interest income that his “personal property fund” generated to that account. In Tellis v. Godinez, 5 F.3d 1314 (9th Cir.1993) CTellis), cert. denied, 513 U.S. 945, 115 S.Ct. 354, 130 L.Ed.2d 309 (1994), we held that Nevada prisoners have a property interest protected by the Due Process Clause in any interest earned on their accounts. We relied in part on Nevada Revised Statute § 209.241, which provided at the time that “[t]he interest and income earned on the money in the fund, after deducting any applicable charges, must be credited to the fund.” Tellis, 5 F.3d at 1316. We also cited the Supreme Court’s decision in Webb’s Fabulous Pharmacies v. Beckwith, 449 U.S. 155, 164, 101 S.Ct. 446, 452-53, 66 L.Ed.2d 358 (1980), which held that “[t]he earnings of a fund are incidents of ownership of the fund itself and are property just as the fund itself is property.” Tellis, 5 F.3d at 1317.
Shortly after our decision in Tellis, the Nevada Department of Prisons revised its standard fiscal agreement. The new agreement authorized deductions from inmate accounts for several new items, including “the cost of any expense incurred by NDOP on my behalf, whether I incurred the expense voluntarily or involuntarily.” It also required the inmate to certify that “I understand that the funds on deposit in my savings will not accrue interest for my sole benefit.” On January 10, 1994, the Director of the Department of Prisons circulated a memorandum expanding the Department’s policy requiring inmates to sign a fiscal agreement. “[T]he above referenced Agreement should be signed by ALL inmates in the Nevada Department of Prisons (NDOP) system whether they are employed or not.” The memorandum also provided that “FAILURE TO SIGN A [FISCAL AGREEMENT] BY THE INMATE RENDERS THE INMATE INELIGIBLE TO BE EMPLOYED IN ANY OF THE INMATE WORK PROGRAMS OF NDOP.”
On March 4, 1994, prison employees presented the revised fiscal agreement to Vigno-lo for his signature. Vignolo expressed concern about the provisions authorizing new deductions from his account and waiving any right to interest, and requested an explanation. When no explanation was forthcoming, he refused to sign the agreement. On March 25,1994, Vignolo was informed that he would be fired from his prison job if he did not sign the agreement. He again refused to sign, and the Department of Prisons terminated his employment.
*1077Vignolo filed this pro se action against various prison officials and workers (prison officials) in the district court on October 20, 1994. Among other things, Vignolo alleged that the Nevada Department of Prisons “retaliated against and punished Plaintiff for exercising his constitutional rights when Plaintiff was fired from his prison job assignment when he refused to sign a revised ‘Fiscal Agreement’ that effectively impaired, restricted and disregarded Plaintiff’s constitutional right to not be deprived of personal property without due process of law.” Four other inmates filed similar complaints, and the actions were consolidated in the district court. On December 23, 1994, the prison officials filed a motion to dismiss and a motion for summary judgment. Vignolo opposed those motions, and filed his own motion for summary judgment. The district court granted the prison officials’ motion to dismiss, and, for that reason, denied both cross-motions for summary judgment. The court held that “[pjlaintiffs were fired from prison employment for not signing the agreement, but they were not required to give up one constitutional right in order to preserve another. There is no constitutional right to prison employment.”
On appeal, Vignolo, now well represented by the University of Idaho College of Law Legal Aid Clinic, concedes that there is no constitutional right to prison employment. He argues that his termination nonetheless violated his constitutional rights because it was in “retaliation” for constitutionally protected activity, or because the Department of Prisons placed an unconstitutional condition on a discretionary government benefit.
In July 1995, the Nevada Legislature amended the state statutes governing inmate accounts. Nevada Revised Statute § 209.241 was amended to provide that “[tjhe provisions of this chapter do not create a right on behalf of any offender to any interest or income that accrues on the money in the prisoners’ personal property fund.” Nevada Revised Statute § 209.246 was amended to authorize several of the deductions mentioned in the revised fiscal agreement that the prior law did not expressly authorize.
II
A trial court’s dismissal of a complaint for failure to state a claim is a ruling of law which we review de novo. Stone v. Travelers Corp., 58 F.3d 434, 436-37 (9th Cir. 1995). All allegations of material fact in the complaint are taken as true and construed in the light most favorable to the nonmoving party. Smith v. Jackson, 84 F.3d 1213, 1217 (9th Cir.1996). A complaint should not be dismissed unless it appears beyond doubt that a plaintiff can prove no set of facts in support of his claim which would entitle him to relief. Parks School of Business v. Symington, 51 F.3d 1480, 1484 (9th Cir.1995).
The district court held that Vignolo could not prove any set of facts in support of his claim that would entitle him to relief because he has no constitutional right to prison employment. We agree with the district court’s premise, but not its conclusion. Vignolo’s concession that he has no constitutional right to prison employment is not necessarily fatal to Vignolo’s claim.
We have recognized in several different contexts that a State may not use its control over discretionary government benefits in a manner that places excessive burdens on certain constitutional rights. Under the doctrine of “unconstitutional conditions,”
even though a person has no “right” to a valuable governmental benefit and even though the government may deny him the benefit for any number of reasons, there are some reasons upon which the government may not rely. It may not deny a benefit to a person on a basis that infringes his constitutionally protected interests — especially, his interest in freedom of speech. For if the government could deny a benefit to a person because of his constitutionally protected speech or associations, his exercise of those freedoms would in effect be penalized and inhibited. This would allow the government to “produce a result which [it] could not command directly.” Such interference with constitutional rights is impermissible.
Perry v. Sindermann, 408 U.S. 593, 597, 92 S.Ct. 2694, 2697, 33 L.Ed.2d 570 (1972) (citation omitted). Thus, an inmate may not be *1078transferred to a new prison in retaliation for exercising his or her First Amendment rights, “despite the fact that prisoners generally have no constitutionally-protected liberty interest in being held at, or remaining at, a given facility.” Pratt v. Rowland, 65 F.3d 802, 806 (9th Cir.1995); see also Rizzo v. Dawson, 778 F.2d 527, 532 (9th Cir.1985) (Rizzo). Although not directly applicable to a prison environment, we applied similar principles to hold that a city could not condition a discretionary permit upon a waiver of Fifth Amendment property rights. See Parks v. Watson, 716 F.2d 646, 652-53 (9th Cir.1983); see also Dolan v. City of Tigard, 512 U.S. 374, 385, 114 S.Ct. 2309, 2317, 129 L.Ed.2d 304 (1994) (Dolan); Nollan v. California Coastal Commission, 483 U.S. 825, 107 S.Ct. 3141, 97 L.Ed.2d 677 (1987); Hyland v. Wonder, 972 F.2d 1129 (9th Cir.1992), cert. denied, 508 U.S. 908, 113 S.Ct. 2337, 124 L.Ed.2d 248 (1993).
Thus, even in a prison setting, the Constitution places some limits on a State’s authority to offer discretionary benefits in exchange for a waiver of constitutional rights. Those limits are finite, and we recognize that Nevada may have important countervailing interests in the efficient management of its prisons. Cf. Rizzo, 778 F.2d at 532 (successful retaliation claim must allege retaliation and that prison officials’ actions either did not advance legitimate correctional goals or were not narrowly tailored to meet those goals); Dolan, 512 U.S. at 385-86, 114 S.Ct. at 2316-17 (requiring applicant for benefit to forgo constitutional right unlawful if condition lacks sufficient nexus to benefit conferred). Nonetheless, we conclude that the district court erred by dismissing Vignolo’s complaint on the bare ground that there is no constitutional right to prison employment.
Because the district court granted the prison officials’ motion to dismiss at a preliminary stage of the litigation, we have little factual record from which to analyze Vigno-lo’s claim. We do not wish to burden the district court’s analysis of this complex case with excessive speculation about the potentially applicable legal principles. We hold only that it was error to dismiss Vignolo’s action for failure to state a claim upon which relief may be granted. Accordingly, we reverse the district court’s order granting the prison officials’ motion to dismiss, we vacate the order denying both cross-motions for summary judgment, and remand the case for further proceedings.
Each side shall bear its own costs.
REVERSED IN PART, VACATED IN PART, AND REMANDED.