This case was before us previously on the appeal of the Commissioner of Correction and the Superintendent of the Massachusetts Correctional Institution at Cedar Junction (collectively, the commissioner) from a separate and final judgment under Mass. R. Civ. R 54 (b), 365 Mass. 820 (1974), after a judge in the Superior Court allowed the plaintiffs’ motion for summary judgment on their due process claim. The judge enjoined the commissioner from confining inmates for nondisciplinary reasons in the East Wing at Cedar Junction in conditions that were comparable to the former department segregation unit (DSU)3 without affording them the procedural protections contained in 103 Code Mass. Regs. §§ 421.00 (1993). See Haverty v. Commissioner of Correction, 437 Mass. 737, 750 *3(2002). In that case we held, without reaching the constitutional question, that inmates housed in near-solitary confinement in the East Wing, for nondisciplinary reasons, except those staying no more than a few days for classification, were entitled to “the procedural protections contained in 103 Code Mass. Regs. §§ 421.00.” Id. at 763. We affirmed the order for injunctive relief and remanded the case for further proceedings and to determine the timing and manner of the implementation of those regulations. Id. at 764. After the case had been remanded, and pending implementation of the regulations, a second judge in the Superior Court held a hearing on the plaintiffs’ prayer that they be granted earned good time credit under G. L. c. 127, § 129D,4 for the time that they were illegally housed in DSU-like conditions. He then issued the following interim order: “As an equitable remedy for unlawful confinement in the East Wing DSU at MCI-Cedar Junction, the Commissioner shall promptly award all such prisoners eligible[5] for earned good time credit under G. L. c. 127, § 129D, with 3.75 days of retroactive earned good time credit for each month spent confined in the East Wing DSU, and shall recalculate their release dates based on said earned good time credit.”
The commissioner moved for reconsideration of the order and for a stay of the order pending interlocutory review. Both motions were denied. The commissioner filed a petition in the *4Appeals Court seeking interlocutory review under G. L. c. 231, § 118. The petition was denied. He then filed a petition in the county court seeking relief under G. L. c. 211, § 3. The single justice granted a partial stay of the order and reserved and reported, without decision, the following questions to the full court: “(1) whether, in this case, the trial judge had the power to grant equitable relief to certain plaintiffs in the form of good-time credits; and (2) if the judge did have the power to do so, whether that part of the . . . order granting as equitable relief to those plaintiffs 3.75 days of good-time credits per month served in the East Wing of MCI-Cedar Junction constituted an abuse of discretion.” We answer the first question in the negative, and therefore do not address the second question.
1. Background. The material facts are not disputed. Inmates can earn up to a maximum of seven and one-half days of earned good time credit, per month, under G. L. c. 127, § 129D. The system-wide average of earned good time credits is three days a month for each prison inmate. Two-thirds of all prison inmates are held in medium security prisons, where the bulk of the § 129D programs exist. Cedar Junction, the State’s only maximum security prison, is divided into two “wings,” the East Wing and the West Wing. The East Wing consists of eight units, each with forty-five one-man cells; the West Wing has three units, each with seventy-two one-man cells. Inmates in the East Wing, the more restrictive wing, have been held under conditions that constitute segregated confinement; those in the West Wing have not. See Haverty v. Commissioner of Correction, supra at 742-743. There were twenty-seven jobs available for inmates housed in the East Wing through which good time credits could be earned; there were 150 such jobs for inmates housed in the West Wing. Inmates in the West Wing earned an average of one and one-quarter to one and one-half days of good time credits each month. Inmates in the East Wing earned less. During the relevant time periods at issue in this appeal, there were no educational programs at either wing of Cedar Junction through which inmates could earn good time credits.6
It is the policy of the department, as stated by the commis*5sioner, that the limited resources available for earned good time credit programs should be offered primarily to those inmates who are motivated to make the best use of them. Inmates who are disruptive and resistant to rehabilitation are offered fewer such opportunities. When those inmates demonstrate an improvement in attitude toward rehabilitation, they are offered more opportunities to earn good time credits. The commissioner offers earned good time credit programs both as a means to improve an inmate’s chances for a successful return to society and as an inducement for inmates to control and reduce their tendencies toward violence.7 He indicated, and it was not contradicted, that this policy has had a marked effect at reducing the level of violence within the prison system.
The judge determined that “it is fair and just to award 50% of the maximum amount of earned good time credit that eligible members of the plaintiff class could have potentially received if they had not been illegally confined to the East Wing DSU.” He reasoned that, although “there is no way to predict with any degree of mathematical certainty how many days of earned good time credit a particular member of the plaintiff class would have received but for the illegal conduct of the Department of Correction,” “it is likely that many members of the plaintiff class . . . would have had the opportunity to earn up to 7.5 days per month of earned good time credit.”
2. Discussion. The commissioner argues that the judge erred by fashioning an equitable remedy that awarded good time credits that were not earned, in disregard of the requirements of § 129D. The plaintiffs argue that the remedy was appropriate because they were illegally denied the ability to earn good time credits under § 129D, and that the judge had discretion to fashion an equitable remedy to address the resulting lost opportunities to reduce the length of their sentences.
There is no constitutional right to good time credits. See Jackson v. Hogan, 388 Mass. 376, 379 (1983), citing Wolff v. *6McDonnell, 418 U.S. 539, 557 (1974). Section 129D does not establish a statutory right to the availability of earned good time credits. See Jackson v. Hogan, supra. Programs for earned good time credit are made available to inmates housed at the different facilities of the department, in the discretion of the commissioner. See 103 Code Mass. Regs. § 411.08(2) (1995) (“The Associate Commissioner or his designee will prepare lists of programs which he has approved for good time deductions at each institution” [emphasis added]). The only statutory or regulatory limit on this discretion is contained in 103 Code Mass. Regs. § 421.21 (1993), which states that, within any institution, “[programs [for inmates in a DSU] shall be the same as are provided to inmates in the general population, except as inconsistent with the security needs of the DSU.”
To the extent that there were programs for earning good time credits in the East Wing, those programs were available equally to all inmates housed there. There is no suggestion that the East Wing was used as the DSU for the West Wing for purposes of establishing the number of good time credit programs that should have been made available under 103 Code Mass. Regs. § 421.21 to East Wing inmates.8 Just as inmates in the West Wing are offered fewer opportunities to earn good time credits than inmates in medium security prisons because they are considered less motivated to make the most of the department’s limited resources, the inmates in the East Wing have even fewer opportunities than those in the West Wing because the uncontroverted testimony indicated that the commissioner determined that their motivation to succeed in such programs is lower yet.
The commissioner’s decision to limit the opportunities for inmates in the East Wing to earn good time credits was based on a rational determination to allocate resources where they could be utilized most effectively. That decision was within the commissioner’s discretion “to determine priorities for allocation of resources . . . where the enabling statute does not itself clearly establish particular priorities.” Williams v. Secretary of the Executive Office of Human Servs., 414 Mass. 551, 567 (1993). The commissioner’s decision is entitled to deference, *7and the plaintiffs have not shown that it was irrational. See Hastings v. Commissioner of Correction, 424 Mass. 46, 53 (1997). The plaintiffs were not illegally denied the opportunity to earn good time credits.
The plaintiffs contend that the judge could properly fashion an equitable remedy that included good time credits because the summary judgment judge determined that the few opportunities to earn good time credits in the East Wing was a “ ‘significant factor’ in support of [his] conclusion that [the] plaintiffs’ rights were violated.” We disagree. The focus of our inquiry in Haverty was “on the degree of restriction — e.g., the amount of time a prisoner is confined to his cell — and the length of time the prisoner is subjected to the more restrictive conditions.” Haverty v. Commissioner of Correction, supra at 756 n.23, citing Sandin v. Conner, 515 U.S. 472, 486 (1995). The injunctive relief the plaintiffs ultimately obtained was tailored to the fact that they were confined in their cells under DSU-like conditions (solitary confinement for twenty-two and one-half hours each day for an indeterminate period averaging 270 days). See Haverty v. Commissioner of Correction, supra at 743-744, 756-757. The administrative decision to hold them in such conditions without the benefit of procedural safeguards was wrong, and the remedy we approved addressed that wrong. The paucity of earned good time credit programs at the East Wing undoubtedly had an impact on the inmates, but the commissioner’s decision to offer few such programs has not been shown to be unlawful, and the effect of that decision was neither necessary nor essential to our decision concerning the unlawful confinement of the plaintiffs. “Where equitable relief is appropriate, it should be confined within narrow limits” determined by the necessities of the case. Boston Teachers Union, Local 66 v. Boston, 382 Mass. 553, 566 (1981). Here, the administrative decision that resulted in the wrongful confinement of the plaintiffs was unrelated to the decision to offer fewer opportunities to earn good time credits, and therefore the order necessitated by the former should not have implicated the latter.
The plaintiffs argue that they are entitled to the award of earned good time credits as provided in G. L. c. 127, § 129D, because such awards are an established method of compensat*8ing prisoners harmed by prison authorities’ illegal conduct. The three cases on which they principally rely are distinguishable. In Hoffer v. Commissioner of Correction, 412 Mass. 450 (1992), the judge’s award of earned good time credit was not before us on appeal; hence, that aspect of the case does not constitute appellate precedent, and it is not binding in this case on the current commissioner, who was not commissioner at the time. Cf. Doris v. Police Comm’r of Boston, 374 Mass. 443, 449 (1978) (application of doctrine of equitable estoppel to bar enforcement of statute previously unenforced is contrary to public interest in enforcement of laws). In Blake v. Commissioner of Correction, 403 Mass. 764 (1989), the then commissioner also did not appeal from that aspect of the judgment that awarded earned good time credits; hence, the issue was not before us. In Piggott v. Commissioner of Correction, 40 Mass. App. Ct. 678 (1996), the issue before the Appeals Court was the alleged wrongful withholding of good time credits actually earned. That case did not involve an award of unearned credits for alleged lost opportunities.
The award of earned good time credits in unpublished decisions cited by the plaintiffs, involving cases of prison overcrowding, is inapt. Here, unlike those cases, there was no unconstitutional condition that prevented an inmate from participating in an earned good time credit program. The DSU-like conditions here did not prevent participation in an earned good time credit program. Indeed, such programs, by regulation, must be offered to inmates in the DSU to the same extent that they are offered to inmates in the general population, absent security considerations. See 103 Code Mass. Regs. § 421.21. Here, the commissioner simply decided to provide a limited number of programs to all inmates in the East Wing, a decision that was unrelated to the length of time inmates there spend by themselves.
Moreover, “ ‘[cjourts of equity can no more disregard statutory and constitutional requirements and provisions than can courts of law.’ Hedges v. Dixon County, 150 U.S. 182, 192 (1893). ‘A [cjourt of equity cannot, by avowing that there is a right but no remedy known to the law, create a remedy in violation of law.’ Rees v. Watertown, [86 U.S.] 19 Wall. 107, 122 *9(1874).” Immigration and Naturalization Serv. v. Pangilinan, 486 U.S. 875, 883 (1988). See Freeman v. Chaplic, 388 Mass. 398, 406 n.15 (1983) (“grant of equitable powers does not permit a court to disregard statutory requirements”); Rossi Bros. v. Commissioner of Banks, 283 Mass. 114, 119 (1933) (“It is a maxim that equity follows the law as declared by a statute”). The clear language of the statute indicates that good time credits awarded under § 129D must be earned. The legislative history buttresses the clear language of the statute, indicating that earned good time credits should “make incarceration a more personally rewarding experience and improve prisoners’ lives outside of prisons.” Burno v. Commissioner of Correction, 399 Mass. 111, 120 n.8 (1987), citing 1973 Sen. Doc. No. 1504, at 50-51. This is also consistent with the legislative policy behind G. L. c. 124, § 1 (e), which authorizes the commissioner to create programs to rehabilitate inmates and thereby make their reentry into society more likely to succeed. Awarding credits where an inmate has not satisfactorily participated in such programs is contrary to the statutory language, the purpose, and the policy behind § 129D, and is thus not a proper subject for an equitable order absent some nexus between the wrong suffered and the purpose of the statute.
Question no. 1 is answered in the negative. We need not address question no. 2. The case is remanded to the single justice for further proceedings consistent with this opinion.
So ordered.
General Laws c. 127, § 39, states: “At the request of the superintendent of any correctional institution of the commonwealth, the commissioner may authorize the transfer, for such period as he may determine, to a segregated unit within any correctional institution of the commonwealth, of any inmate whose continued retention in the general institution population is detrimental to the program of the institution.
“Such segregated unit shall provide regular meals, fully furnished cells, limited recreational facilities, rights of visitation and communication by those properly authorized, and such other privileges as may be established by the commissioner. Under the supervision of the department of mental health, all inmates confined to a segregation unit shall be given periodic medical and psychiatric examinations, and shall receive such medical and psychiatric treatment as may be indicated.”
General Laws c. 127, § 129D, states in relevant part: “For. . . satisfactory completion of an educational program leading to the award of a high school equivalency certificate, satisfactory performance of said prisoner in completion of any other educational sequence or any vocational training program established within or without the institution, satisfactory performance of said inmate when he is employed . . . in a prison industry, or satisfactory performance of said inmates in any other program or activity which the superintendent of the institution shall deem valuable to said prisoner’s rehabilitation, the commissioner may grant. . . a. . . deduction of sentence of not more than two and one-half days per program or activity for each month while said prisoner is . . . working in a prison industry, or partaking in any of the said programs or activities as aforesaid; provided, however, that in no event shall said deductions exceed a maximum monthly total of seven and one-half days.”
A State inmate may receive an earned good time credit under G. L. c. 127, § 129D, “unless the law under which an inmate is committed specifically prohibits the awarding of deductions.” 103 Code Mass. Regs. § 411.07 (1995). See, e.g., G. L. c. 94C, § 32H; G. L. c. 269, § 10E. There is no issue of eligibility in this appeal.
Eamed good time credit for programs in education at Cedar Junction was authorized in 2002.
General Laws c. 124, § 1 (b), authorizes the commissioner to “take all necessary precautions to prevent the occurrence or spread of any disorder” at any correctional facility; § 1 (e) authorizes the commissioner to “establish, maintain and administer programs of rehabilitation . . . designed as far as practicable to prepare and assist each [prisoner] to assume the responsibilities and exercise the rights of a citizen of the commonwealth.”
Each wing has its own segregation unit. See Haverty v. Commissioner of Correction, supra at 743 nn.11 & 12.