This is a petition for a writ of error to reverse a sentence of the Superior Court for the County of Essex by which the petitioner is confined in the state prison. The plea is in millo est erratum, and therefore admits the facts well assigned in the petition. Bodurtha v. Goodrich, 3 Gray, 508, 512. Conto v. Silvia, 170 Mass. 152. From those and from the record of the Superior Court, it appears that the offences of which the petitioner was convicted were committed between July 19, 1892, and November 17, 1893, but that he was sentenced under St. 1895, c. 504, entitled “ An Act relative to sentences to the state prison,” which took effect on the first day of January, 1896, and which provides, in § 1, that “ when a convict is sentenced to the state prison, otherwise than for life, or as an habitual criminal, the court imposing the sentence shall not fix the term of imprisonment, but shall establish a maximum and minimum term for which said convict shall be held in said prison. The maximum term shall not be longer than the longest term fixed by law for the punishment of the offence of which he is convicted, and the minimum term shall not be less than two and one half years.”
The petitioner was indicted under Pub. Sts. c. 203, § 40, and was found guilty on sixty-three counts, each of which, except in a few instances, alleged the value of the property stolen to be more than one hundred dollars. The penalty is prescribed in § 20 of the same chapter, and is imprisonment in the state prison not exceeding five years, or fine not exceeding six hundred dollars and imprisonment in the jail not exceeding two years, if the value of the property stolen exceeds one hundred ■dollars. The maximum sentence imposed in the present case was not more than fifteen years and the minimum not less than ten. The maximum term was therefore only a small fraction of *266that authorized by law, and it is agreed that it probably does not exceed the sentence which would have been imposed before the passage of St. 1895, c. 504.
The error assigned is, that the sentence and the commitment pursuant to it were wholly unauthorized and void, because the statute under which the sentence was imposed was ex post facto, and contrary to Section 10, Article 1, of the Constitution of the United States, and to Article 24 of the Declaration of Rights of the Constitution of Massachusetts.
The statute was considered by this court in Commonwealth v. Brown, 167 Mass. 144, 146, and again in Oliver v. Oliver, 169 Mass. 592. It was also before the court in Commonwealth v. Crowley, 168 Mass. 121. In Commonwealth v. Brown, the court says that it sees no reason why the statute should not be construed to apply to all sentences in the cases referred to in it passed after it went into effect. But it is evident that the attention of the court was directed more to the effect of the feature of indeterminate sentences upon the constitutionality of the statute than to other matters. The fact that the statute might interfere with his rights or privileges in regard to a permit to be at liberty and was therefore objectionable as ex post facto was not suggested in the defendant’s brief. In Oliver v. Oliver, the point decided was that a sentence imposed under the statute in question must be regarded as a sentence for the maximum term, and not for the minimum or any intermediate term. The point now raised was not involved nor considered in that case. Commonwealth v. Crowley followed Commonwealth v. Brown. There was in the opinion no discussion of the statute, and the motion ip arrest of judgment did not aver that the statute was unconstitutional because of its interference with the defendant’s rights to a permit to be at liberty for good conduct under Pub. Sts. c. 222, § 20, or otherwise. An examination of the defendant’s brief shows that the ground on which it was contended that the statute was unconstitutional was the indetermina te feature of the sentences. This had been fully considered ando disposed of in Commonwealth v. Brown, and hence a reference to that case was all that was necessary. We discover nothing in either of these cases which precludes us from examining the question now presented. The statute was also considered by the United States *267Circuit Court for the First Circuit when this plaintiff was before it recently on a petition for a writ of habeas corpus, which it was led to deny, and to leave the petitioner to his writ of error, largely, as we infer, on account of the views concerning the statute which this court was supposed to have expressed in the two cases of Commonwealth v. Brown and Oliver v. Oliver, referred to above. In re Murphy, 87 Fed. Rep. 549.
We have already quoted § 1 of the act. By § 2 it is provided that at any time after the expiration of the minimum, term the commissioners of prisons may issue a permit to the convict to be at liberty on such terms and conditions as they may deem best, and may revoke the permit at any time previous to the expiration of the maximum term. The permit shall not be issued without the approval of the Governor and Council or unless the commissioners shall be of the opinion that the convict will lead an orderly life i£ set at liberty. Other provisions contained in the act were taken from St. 1884, c. 152, §§ 1 and 2, which will be referred to later.
The statutes applying to the petitioner’s case which were in force when he committed the offences of which he was convicted are Pub. Sts. c. 222, §§ 20, 21, 22, and St. 1884, c. 152. There were and are statutes relating to the issue of permits to persons confined for drunkenness in jails, houses of correction, or other places under the jurisdiction of the county commissioners, or in the county of Suffolk under that of the board of directors of public institutions and who have reformed, and also to persons imprisoned in the reformatory prison for women who have reformed. But those are not applicable to this case.
Pub. Sts. c. 222, § 20, provide that every officer in charge of a prison or other place of confinement shall keep a record of each person whose term is not less than four months and “ every such prisoner whose record of conduct shows that he has faithfully observed all the rules and has not been subjected to punishment shall be entitled to a deduction from the term of his imprisonment to be estimated as follows,” stating it. Later in the section, it is provided: “ Each prisoner who is entitled to a deduction . . . shall receive a written permit to be at liberty during the time thus deducted upon such terms as the board granting the same shall fix.” The permits are to be issued to *268prisoners in the state prison by the commissioner's of prisons, and they “ may at any time revoke the same, and shall revoke it when it comes to their knowledge that the person to whom it was granted has been convicted of any offence punishable by imprisonment.”
St. 1884, c. 152, § 1, provides that if the holder of a permit shall violate any of its terms or conditions, or any law of this Commonwealth, “ such violation shall of itself make void said permit.” Section 2 provides that, when any permit has been revoked or has become void, the board granting it may cause the holder of it to be arrested and returned to the place in which he was confined, and when so returned he “ shall be detained therein according to the terms of his original sentence,” and “ the time between his release upon said permit and his return to said place of confinement shall not be taken to be any part of the term of the sentence.” These provisions are embodied in St. 1895, c. 504, and are the ones previously referred to. The other provisions of St. 1884, c. 152, are not now material.
From this examination it appears that St. 1895, c. 504, differs from the statutes which were in force at the time when the offences were committed, and that the differences consist, first, in the matter of indeterminate sentences; secondly, in providing that the permit shall not be issued till after the expiration of the minimum sentence, and in omitting any provision for deductions for good behavior; and, thirdly, in leaving the issue of the permit to the discretion of the commissioners, and in providing that it shall receive the approval of the Governor and Council. The petitioner contends that the effect of these differences may be to make the term of imprisonment longer than it would have been under the laws in force at the time the offences were committed, and to change his position in other respects to his disadvantage, and that therefore the statute is unconstitutional and void. The Commonwealth contends that the provisions are in the nature of prison discipline, or of penal administration or criminal procedure, and are not therefore open to the objection of being ex post facto.
As the term ex post facto has been construed, it applies only to penal or criminal matters. The objection to ex post facto legislation consists in the uncertainty which would be intro*269duced thereby into legislation of a penal or criminal character, and the injustice of punishing an act which was not punishable when done, or of punishing it in a different manner from that in which it was punishable when done. But not all retrospective legislation is unconstitutional as being ex post facto. The question in each case is whether it will increase the penalty, or operate to deprive a party of substantial rights or privileges to which he was entitled as the law stood when the offence was committed, or “ in short, which, in relation to the offence or its consequences, alters the situation of a party to his disadvantage.” Kring v. Missouri, 107 U. S. 221, 228. Colder v. Bull, 3 Dall. 386. Cumming v. State, 4 Wall. 277. Ex parte Garland, 4 Wall. 333. Medley, petitioner, 334 U. S. 160. Duncan v. Missouri, 152 U. S. 377. Thompson v. Utah, 170 U. S. 343. Hartung v. People, 22 N. Y. 95. Shepherd v. People, 25 N. Y. 406. Ratzky v. People, 29 N. Y. 124. A statute which mitigates the penalty is not objectionable, though passed after the offence; (Commonwealth v. Wyman, 12 Cush. 237 ; Commonwealth v. Gardner, 11 Gray, 438; Dolan v. Thomas, 12 Allen, 421,424;) nor, speaking generally, are statutes which relate to procedure or penal administration or prison discipline, even though the effect may be in the last two instances to enhance the severity of the confinement. Duncan v. Missouri, 152 U. S. 377. Cook v. United States, 138 U. S. 157. Hopt v. People, 110 U. S. 574. Gut v. State, 9 Wall. 35. Commonwealth v. Hall, 97 Mass. 570. Carter v. Burt, 12 Allen, 424. Hartung v. People, 22 N. Y. 95. Marion v. State, 20 Neb. 233. Ex parte Bethurum, 66 Mo. 545. People v. Mortimer, 46 Cal. 114. Cooley, Const. Lim. (3d ed.) 272. Black, Const. Law, § 184. No one has a right to insist that particular remedies shall remain unchanged, or that courts and their jurisdiction and the proceedings in them shall continue unaltered, or that there shall be no departure from established methods in prison discipline or penal administration. But the Legislature, under the guise of laws relating to procedure or prison discipline or penal administration, cannot take away or interfere with any substantial right or privilege which was-secured to a party by the law as it was when the offence was committed. Kring v. Missouri, 107 U. S. 221, 232. Thompson v. Utah, 170 U. S. 343. Medley, petitioner, 134 U. S. 160. To *270deprive him in any manner of such right or privilege would be to increase the penalty. In determining in any case whether this is or is not the effect of a statute, it is to be borne in mind that the constitutional provision was intended as a security to life and liberty, and as a safeguard against the infliction of any punishment except such as was duly authorized by law, and it is to be construed so as to promote these ends.
As the law formerly stood in this State the effect of good conduct on the part of the prisoner was to shorten his term of imprisonment, and to give him a right to his discharge at the expiration of the shortened term. St. 1857, c. 284. St. 1858, c. 77. St. 1859, c. 108. Gen. Sts. c. 178, § 47. This was so said in the Opinion óf the Justices, 13 Gray, 618. And although the St. of 1857, c. 284, was entitled “ An Act concerning the discipline of the state prison,” and the acts of 1858 and 1859 were respectively entitled “ An Act concerning the discipline of jails and houses of correction,” and “ An Act to amend an Act concerning the discipline of jails and houses of correction,” it does not seem to have occurred to the Justices that the right of the convict was affected thereby. They declared, on the contrary, that the act of 1857, upon the construction of which the answer to the question proposed mainly depended, gave the convict a right to-have his term reduced and shortened by the scale provided in it for good behavior, and bore upon the sentence and shortened the term of imprisonment, and afforded :<an assurance of the highest character that, upon condition of good behavior, the convict shall have the promised benefit of an earlier release.” And again they said that “ the benefit promised, in consideration of good behavior, was intended to be an actual reduction of sentence as a right, and not as a favor,” and “ therefore operated upon the sentence itself.” It would seem plain, therefore, that a subsequent statute which interfered to his disadvantage with the right of deduction for good behavior to which a convict was entitled at the time of the commission of the offence under the acts of 1857, 1858, and 1859, would have been unconstitutional and void, notwithstanding the fact that those acts related, according to their titles, to the discipline of the state prison, and to that of jails and houses of correction, and therefore appeared to pertain to prison regulation. To have taken *271away the right of deduction for good behavior, or to have interfered with it to the disadvantage of the convict, would have been in. effect to lengthen the sentence which was provided by law for the offence at the time when it was committed ; and a statute which did that clearly would have been ex post facto. See Opinion of the Justices, 13 Gray, 618; Kring v. Missouri, 107 U. S. 221; Medley, petitioner, 134 U. S. 160; Thompson v. Utah, 170 U. S. 343; Commonwealth v. McDonough, 13 Allen, 581; In re Canfield, 98 Mich. 644; Ex parte Hunt, 28 Tex. App. 361.
The question then is whether the changes made in regard to deductions for good behavior by St. 1880, c. 218, which were subsequently incorporated into and are now found in Pub. Sts. c. 222, § 20, have so modified the rights which convicts had, under statutes previously in force, that those committing offences after the passage of St. 1880, c. 218, cannot be said to have anything in the nature of a right to deductions for good conduct, and to a permit to be at liberty which could not be interfered with to their disadvantage by subsequent legislation, — in other words, whether the effect of St.. 1880, c. 218, and of the Public Statutes, has been and is to make deductions for good behavior and the issuing of a permit a matter of favor, and not in any sense a matter of right.
It should be noted in passing, that the words £< with the consent of the Governor and Council,” were inserted in Gen. Sts. c. 179, § 51, which, with one other amendment that is not now material, is a re-enactment of St. 1-857, c. 284, § 1. These words were not in the Commissioners’ Report (c. 180, § 50), and it does not appear how they came to be inserted. They were not in Gen. Sts. c. 178, § 47, and were omitted from St. 1880, c. 218, and are not found in any subsequent statute.
It seems to us that, under St. 1880, c. 218, and Pub. Sts. c. 222, § 20, the convict was and is entitled to deductions for good conduct, and to a permit to be at liberty for the time thus deducted, as a matter of right rather than of favor. The object was to furnish an incentive to good conduct while the convict was in confinement, by offering him a reward therefor. Applying the language of the Opinion of the Justices, ubi supra, the provisions of St. 1880, c. 218, and of the Public Statutes, “afford an assurance of the highest character that, upon condition of good *272behavior, the convict shall have the promised benefit ” of certain deductions, and a permit to be at liberty for the time thus deducted from the term of his sentence. Though the provisions of St. 1880 and of the Public Statutes may not bear as directly upon the sentence as those of St. 1857 did, we cannot doubt that the purpose was to secure to the convict a substantial advantage as a reward for his good conduct, which practically would have the effect of shortening his sentence. It is true that the prison commissioners could revoke the permit without cause shown, or for a violation of its terms, and that they are bound to revoke it when they have knowledge that the convict has been convicted of an offence punishable by imprisonment. But this does not affect the right of the convict to deductions, and to a permit in the first instance. Besides, it is to be assumed that the power of revocation will not be exercised capriciously. Unless the provisions of the statute were intended to secure a substantial advantage to, the convict as a reward for his good conduct, to the enjoyment of which he could look forward with reasonable certainty, if he did not violate the terms of the permit, nor commit an offence punishable by imprisonment, it is difficult to see what object the Legislature had in view.
Gonlon’s case, 148 Mass. 168, is relied on as tending to show that the convict had no right to a permit. One of the contentions of the petitioner in that case was that his confinement in the reformatory was unlawful, because his removal to it from the state prison to which he had been sentenced interfered with or took away his right to deductions for good conduct, under Pub. Sts. c. 222, § 20. But neither that statute nor St. 1880, c. 218, of which it was a re-enactment, was in force at the time when the petitioner committed the offence of which he was convicted, and no question under either was properly before the court. Further, deductions for good conduct under Pub. Sts. c. 222, § 20, are not limited to persons confined in the state prison, but extend to those confined in “ a prison or other place of confinement,” and the Legislature had the right to change the place of confinement of any prisoner so long as the penalty was not thereby aggravated. Carter v. Burt, 12 Allen, 424. Lastly, the permit in that case was issued under St. 1884, c. 152, and was revoked by the commissioners for a violation of its con*273ditions, as they had the right to do. The decision would have been the same if the permit had issued under Pub. Sts. c. 222, § 20, and had been revoked for a like cause. The nature of the right to a permit under Pub. Sts, c. 222, § 20, was therefore not material to the decision.
For these reasons the case, though rightly decided, cannot be regarded as authoritative on the question now before us. And we think, as has been already observed, that St. 1880, c. 218, and Pub. Sts. c. 222, § 20, secured to prisoners who were convicted of offences committed when they were in force, and who came within their scope, deductions for good conduct and permits to be at liberty as something to which they were entitled as of right rather than by favor, for faithful observance of the rules, and for not having been subjected to punishment, and that their rights in these respects could not be taken away or interfered with to their disadvantage by subsequent legislation.
The next question is whether St. 1895, c. 504, alters or may alter to their disadvantage in a substantial manner the position of those committing offences prior to its passage and while Pub. Sts. c. 222, § 20, was in force. We think that it is clear that such might be its effect. In case the maximum sentence was for fifteen years, the convict would be entitled for good conduct to deductions under Pub. Sts. c. 222, § 20, which would shorten the term to twelve. Under St. 1895, c. 504, however, he could be sentenced for a maximum term of fifteen years and a minimum of thirteen, or of any number less than fifteen and more than twelve. In the present case the minimum was ten, and it is possible that the statute might operate more beneficially in the case of the petitioner than Pub. Sts. c. 222, §20, and St. 1884, c. 152, would have operated. But that cannot avail. A law cannot be constitutional in some cases and unconstitutional in others involving like circumstances and conditions. If it is unconstitutional as to any, it is unconstitutional as to all.
It is suggested in In re Murphy, 87 Fed. Rep. 549, that the supposed leniency of St. 1895, c. 504, might have led the court to make the maximum sentence longer than it otherwise would, and the implication is that this also would render the statute objectionable as to past offences. But it is obvious that this argument might prevent the application of any mitigative stat*274ute to past offences, and we should hesitate to pronounce the act unconstitutional on that ground.
It is also said in In re Murphy, that under St. 1895, c. 504, “ important conditions were added which would permit the recall of a permit, and still others which would revoke it absolutely. The most serious new provision is that the act of 1895 directs that, if a permit is revoked, no portion of the time the prisoner may have been at liberty under it shall be taken to be any part of the term of his sentence.” But this last provision, which is called “ the most serious new provision ” of St. 1895, is found in Pub. Sts. c. 222, § 21, and in St. 1884, c. 152, § 2, and was not therefore new, and was in force when the offences were committed of which the petitioner was convicted, and applied to persons confined in the state prison. So far as the revocation of permits is concerned, it is doubtful if St. 1895, c. 504, adds anything new. Under Pub. Sts. c. 222, § 20, the commissioners have power, as already observed, to revoke permits without cause shown. They have the same power under St. 1895, c. 504. Under St. 1884, c. 152, a violation by the holder of a permit of any of its terms or conditions, or of any law of this Commonwealth, rendered the permit void. The same is true under St. 1895, c. 504. And the provisions as to the return of the holder of a permit which has been revoked or has become void are the same in St. 1895, c. 504, as in St. 1884, c. 152, except that the latter contains a provision that the order for the arrest and return of the convict may be served by any officer authorized to serve civil or criminal process in any county in the Commonwealth which is omitted from St. 1895, c. 504. So far, therefore, as revocation and the results which follow it, and violation of the terms and conditions of the permit, or of any law of the Commonwealth, and the results which follow that are concerned, there would seem to be nothing in the statute of 1895 which as compared with the laws in force when the offence was committed changes the situation of the petitioner for the worse.
The petitioner farther contends that, independently of the effect of the statute upon his right to deductions for good behavior and to a permit to be at liberty, the statute is inoperative as an ex post facto act because it renders the duration of his *275sentence uncertain, and gives to the prison commissioners the power to fix the term of his imprisonment. But there is no uncertainty in the sentence itself. That, it has been held, is in effect for the maximum term. Oliver v. Oliver, and Commonwealth v. Brown, ubi supra. People v. Illinois State Reformatory, 148 Ill. 413. State v. Peters, 43 Ohio St. 629. The convict may be released before its expiration, either by an absolute or conditional pardon from the Governor, (Pub. Sts. c. 218, §§ 12 et seq.,) or after the expiration of the minimum term by a permit from the commissioners approved by the Governor and Council. In the latter case, he is under sentence till the expiration of the maximum term. Oliver v. Oliver, ubi supra. It is as correct, it seems to us, to say that the duration of his sentence is uncertain because the Governor may pardon him absolutely or conditionally at any time, as it is to say that it is uncertain because after the expiration of the minimum term the commissioners may release him before the expiration of the maximum term on a permit approved by the Governor and Council, and as correct to say that in case of a pardon the Governor fixes the term of imprisonment, as to say that in case of release upon a permit the commissioners fix it. Moreover, “ the form of sentence,” as was said in Commonwealth v. Brown, “ is made to recognize and carry out a policy familiar to our legislation and acted on heretofore without question.” In no just sense can it be said, we think, that the duration of his sentence is uncertain, or that the determination of the term of the imprisonment is taken from the courts where it belongs, and left to the prison commissioners. See People v. Illinois State Reformatory, 148 Ill. 413; George v. People, 167 Ill. 447; State v. Peters, 43 Ohio St. 629; Miller v. State, 40 L. R. A. 109; contra, People v. Cummings, 88 Mich. 249.
The petitioner also insists that requiring the approval of the Governor and Council to a permit is a serious interference with his rights, and without anything more would render the statute void as an ex post facto law. But we think that the provision does not affect any substantial right to which the petitioner was entitled when the offences were committed, but relates rather to a matter of procedure.
There can be no doubt, we think, that in the matter of per*276mits the Legislature could have substituted some other tribunal for the prison commissioners, or could have added to the number of the commissioners on the same principle that it could have abolished the court which existed when the offences were committed, and have created another court for the trial of such offences, or have added to the number of the judges of the existing court. If this had been the only change, the effect of it would have been merely to require that so many more persons should act in regard to the matter of permits. The petitioner would have still been entitled to deductions for good behavior, and to a permit to be at liberty during the time of such deductions, and there would have been no increase in the penalty for the offence or other change to his disadvantage. It is not contended that the terms and conditions of permits issued when the offence was committed, or the rules of government of the prison then in force, must remain the same.
By St. 1898, c. 371, which is in amendment of and in substitution for St. 1895, c. 504, and which went into effect since the indictment was found in this case, it is now provided that a convict who has faithfully observed all the rules, and has not been subjected to punishment, shall be entitled to release at the expiration of the minimum term, and shall be given a permit to be at liberty during the unexpired portion of the maximum term, which permit shall be issued by the commissioners of prisons. The approval of the Governor and Council is no longer required, and the permit is no longer to be issued at the will and pleasure of the commissioners.
We think, therefore, that the statute of 1895 could not be declared unconstitutional as an ex post facto act because it requires the approval of the Governor and Council to permits to be at liberty, or because it renders the duration of the sentence uncertain, or gives the prison commissioners power to fix the term of imprisonment; but we think that, as the law stood when the offence was committed, the petitioner was entitled to a deduction for good behavior, and to a permit to be at liberty for the time thus deducted, on such terms as the prison commissioners should fix, and subject to revocation by them, and if sentenced under the statute of 1895, this right might be interfered with to his disadvantage, and that the statute is therefore inop*277erative and void as an ex post facto law. We do not see how the statute can be construed as merely a measure of prison discipline or regulation, and therefore liable to change from time to time as the Legislature may see fit without interfering with any rights on the part of the convict.
We have assumed thus far that the act of 1895 applied to all cases of convicts sentenced to the state prison after it took effect, except such as are sentenced for life or as habitual criminals. But we think that it is doubtful, notwithstanding the generality of the language, whether it should be so construed. It is manifest that convicts sentenced under St. 1895 are not entitled to the benefits of Pub. Sts. c. 222, § 20. The sentence is intended to be different in character from that referred to in § 20, and the provisions of that section in regard to deduction for good behavior could not be applied to a sentence under the statute of 1895. Section 20 of the Pub. Sts. c. 222, so far as it relates to convicts sentenced to the state prison, is not repealed in terms by that statute. To hold that that statute operates by necessary implication as a repeal of it to that extent, as it would seem that we should be obliged to do if the statute of 1895 is construed to apply to all sentences to state prison after it took effect, whether the offences occurred before or after it went into operation, (Flaherty v. Thomas, 12 Allen, 428, and Commonwealth v. McDonough, ubi supra,) would result in the discharge of all persons who might have been sentenced under it to the state prison for offences committed before it took effect. On the other hand, by construing it, as we think properly may be done pursuant to the general rule that statutes are to be construed prospectively, to apply to sentences for offences committed after it took effect, this difficulty will be avoided. See Pub. Sts. c. 3, § 3, els. 1, 2 ; Commonwealth v. Sullivan, 150 Mass. 315 ; Commonwealth v. Desmond, 123 Mass. 407; King v. Tirrell, 2 Gray, 331; North Bridgewater Bank v. Copeland, 7 Allen, 139 ; Gardner v. Bacas, 3 App. Cas. 582, 590; Lambard, appellant, 88 Maine, 587.
The result is that, the only error being an error in the sentence, and the Superior Court having jurisdiction to impose such sentence as should be imposed, the sentence in question, in the opinion of a majority of the court, must be reversed, and the case *278remanded to that court for sentence according to the law as it was at the time when the offences were committed before the passage of St. 1895, c. 504. Jacquins v. Commonwealth, 9 Cush. 279. Pub. Sts. c. 187, § 13. So ordered.