Tried to a jury, defendant William Chapman was convicted of possession of heroin with intent to distribute (N.J.S.A. 24:21-19 a(1)), possession of heroin and cocaine (N.J.S.A. 24:21-20 a(1)), and possession in an automobile of a .22-caliber pistol without first having obtained the requisite permit (N.J.S.A. 2A:151-41). The trial judge merged defendant’s conviction for possession of heroin and cocaine with his conviction for possession of heroin with intent to distribute and sentenced defendant to concurrent State Prison terms aggregating one to two years. The custodial sentences were suspended and defendant was placed on probation for two years. In addition, defendant was fined $500 on the possession offenses, the first $25 of which was assessed as a mandatory penalty payable to the Violent Crimes Compensation Board pursuant to N.J.S.A. 2C:43-3.1. Defendant was also assessed a $25 mandatory penalty on his conviction for unlawfully possessing a pistol. He appeals.
Defendant seeks a reversal of his convictions and a remand for a new trial or, alternatively, a reversal of the $25 penalties *476payable to the Violent Crimes Compensation Board on the following grounds set forth in his brief:
POINT I COURT ERRED IN ALLOWING BOTH DEFENDANTS TO BE REPRESENTED BY SAME COUNSEL AT MOTION TO SUPPRESS WITHOUT PROPER WAIVER.
POINT II THE COURT ERRED IN DENYING THE MOTION TO SUPPRESS.
POINT III THE TRIAL COURT ERRED IN IMPOSING A FINE PAYABLE TO THE VIOLENT CRIMES COMPENSATION BOARD.
POINT IV THE COURT ERRED IN ALLOWING FRANK KELAHER TO TESTIFY AS AN EXPERT WITNESS.
We have carefully considered these contentions and all of the arguments advanced by defendant in support of them and find, with the sole exception of the argument concerning the imposition of the mandatory penalties (Point III, supra), that they are clearly without merit. R. 2:11-3(e)(2).
Defendant challenges as unconstitutional ex post facto legislation the imposition of the “mandatory” fines of $25 pursuant to N.J.S.A. 2C:43-3.1 a(2). He contends that the mandatory $25 penalty, which is imposed upon any person convicted of any crime not resulting in the injury or death of another person, was not applicable to him, because the offenses involved were committed prior to September 1,1979, the effective date of the New Jersey Code of Criminal Justice. See N.J.S.A. 2C:98-4. The State’s response, which is less than candid, is that defendant was fined for possession of heroin with intent to distribute under N.J.S.A. 24:21—19 a(1), which permits the imposition of a fine of not more than $25,000, and for possession of a pistol under N.J.S.A. 2A:151-41, which is a high misdemeanor and therefore punishable by a fine of not more than $2,000. See N.J.S.A. 2A:85-6. This argument is not borne out by the statements made by the trial judge at sentencing. On the contrary, it is clear from the sentencing transcript that the trial judge felt constrained to impose upon defendant for each conviction the mandatory $25 penalty required by N.J.S.A. 2C:43-3.1 a(2). We have' no doubt whatsoever that the trial judge imposed the $25 penalty pursuant to the provisions of N.J.S.A. 2C:43-3.1 a(2), which provides:
*477In addition to any other disposition made pursuant to the provisions of N.J.S. 2C:43-2 or any other statute imposing sentences for crimes, any person convicted of an offense under N.J.S. 2C:12-1a, or any crime not resulting in the injury or death of another person shall be assessed a penalty of $25.00 for each such offense or crime for which he was convicted.
In our view, the trial judge erred when he imposed the $25 penalties mandated by N.J.S.A. 2C:433.1 a(2). The new Code, which became effective on September 1, 1979, expressly provides that:
Except as provided in subsections c. and d. of this section, the code does not apply to offenses committed prior to its effective date and prosecutions and dispositions for such offenses shall be governed by the prior law, which is continued in effect for that purpose, as if this code were not in force. For the purposes of this section, an offense was committed after the effective date of the code if any of the elements of the offenses occurred subsequent thereto. [N.J.S.A. 20:1-1 b],
Because defendant committed the crimes for which he was convicted prior to the effective date of the new Code, and because defendant did not voluntarily consent to be sentenced under the new Code pursuant to the provisions of N.J.S.A. 2C:1 1 c(2), the trial judge could not impose mandatory penalties of $25 as part of the sentence. Cf. State v. Davis, 175 N.J.Super. 130, 147 (App.Div.1980), certif. den. 85 N.J. 136 (1980).
The application of the mandatory penalty provisions of the new Code was unquestionably barred by the prohibition of ex post facto legislation found in both the Federal and State Constitutions. U.S. Const, Art. I, § 10, cl. 1, and N.J. Const. (1947), Art. IV, § VII, par. 3. See Dobbert v. Florida, 432 U.S. 282, 292, 97 S.Ct. 2290, 2297, 53 L.Ed.2d 344 (1977); Lindsey v. Washington, 301 U.S. 397, 401-402, 57 S.Ct. 797, 799, 81 L.Ed. 1182 (1937); Beazell v. Ohio, 269 U.S. 167, 169, 46 S.Ct. 68, 70 L.Ed. 216 (1925); State v. Donato, 106 N.J.L. 397, 403 (E. & A. 1930); Lindsley v. Bd. Managers, etc., State Prison, 107 N.J.L. 51, 55 (Sup.Ct.1930), aff’d 108 N.J.L. 415 (E. & A. 1932); State v. Davis, supra, 175 N.J.Super. at 147; State v. Johns, 111 N.J.Super. 574, 575-577 (App.Div.1970), certif. denied, 60 N.J. 467 (1972), cert. den. 409 U.S. 1026, 93 S.Ct. 473, 34 L.Ed.2d 319 *478(1972); Zink v. Lear, 28 N.J.Super. 515, 525 (App.Div.1953). See, also, 1 Wharton’s Criminal Law (Torcia 14 ed. 1978), § 13, at 64-65. As the United States Supreme Court so clearly stated in Lindsey v. Washington, supra, wherein it held the sentencing statute there involved to be ex post facto legislation:
... The Constitution forbids the application of any new punitive measure to a crime already consummated, to the detriment or material disadvantage of the wrongdoer....
We need not inquire whether [the statutory change] is technically an increase in the punishment annexed to the crime, ... It is plainly to the substantial disadvantage of petitioners.... [301 U.S. at 401-402, 57 S.Ct. at 799, 81 L.Ed. 1186]
Accordingly, we reverse and vacate the imposition of the $25 mandatory penalties imposed upon defendant. As so modified, the judgment under review is affirmed. The matter is remanded to the trial court for the entry of an amendatory judgment. We do not retain jurisdiction.