
574 P.2d 605 (1978)
91 N.M. 386
STATE of New Mexico, Plaintiff-Appellee,
v.
Michael D. HOLLAND, Defendant-Appellant.
No. 3172.
Court of Appeals of New Mexico.
January 17, 1978.
*606 Charles G. Berry, Marchiondo & Berry, P.A., Albuquerque, for defendant-appellant.
Toney Anaya, Atty. Gen., Roderick A. Dorr, Asst. Atty. Gen., Santa Fe, for plaintiff-appellee.

OPINION
WOOD, Chief Judge.
Pursuant to a plea bargain approved by the trial court, defendant pled guilty to possession of cocaine. The bargain provided that the disposition of the case would be "no more severe" than "DEFERRED sentence, and probation as the judge may require (not more than 5 years)". The judgment of the trial court deferred sentence and placed defendant on unsupervised probation for two and one-half years. "As a condition of probation, he is fined $3,000." Defendant contends the trial court had no authority to impose a fine as a condition of probation. We agree.
A basic proposition of New Mexico law is that the fixing of penalties is a legislative function, that the trial court's authority is to impose the sentence authorized by law. McCutcheon v. Cox, 71 N.M. 274, 377 P.2d 683 (1962); State v. Hovey, 87 N.M. 398, 534 P.2d 777 (Ct.App. 1975). Sentences or portions thereof which are unauthorized by law are void. Sneed v. Cox, 74 N.M. 659, 397 P.2d 308 (1964); State v. Lucero, 48 N.M. 294, 150 P.2d 119 (1944). These rules apply to probation and the conditions of probation. In re Juan Lujan, 18 N.M. 310, 137 P. 587 (1913).
For the crime of possession of cocaine, the penalty authorized by law is imprisonment of not less than one nor more than five years, a fine not to exceed $5,000.00, or both. Section 54-11-23(B)(5), N.M.S.A. 1953 (Repl.Vol. 8, pt. 2, Supp. 1975) *607 and § 40A-29-11(A), N.M.S.A. 1953 (2d Repl.Vol. 6). The plea bargain, however, limited the penalty to a deferred sentence. See Rule of Crim.Proc. 21(g)(3). A fine is a sentence. State v. Pitts, 26 Ariz. App. 390, 548 P.2d 1202 (1976); Commissioner of Motor Vehicles v. Lee, 255 A.2d 44 (Md. App. 1969). The fine authorized for possession of cocaine could not be imposed because, under the approved plea bargain, any such fine could only be deferred.
No fine was imposed for possession of cocaine; no fine was deferred in connection with the cocaine offense. The fine was imposed as a condition of probation. The plea bargain agreed to probation "as the judge may require". The question is whether the trial court had authority to impose a fine as a condition of probation.
The State has cited several cases where a fine was imposed as a condition of probation. A study of those cases reveals that in the jurisdictions involved, there was specific statutory authority for imposing a fine as a condition of probation. Brown v. State, 559 P.2d 107 (Alaska, 1977); People v. Christensen, 2 Cal. App.3d 546, 83 Cal. Rptr. 17 (1969); People v. Verdich, 44 Ill. App.3d 737, 3 Ill.Dec. 377, 358 N.E.2d 920 (1976); Commonwealth v. Rooney, 233 Pa.Super. 225, 335 A.2d 710 (1975). Concerning the federal statute, see Bell v. United States, 261 F. Supp. 594 (D.C.Ill. 1966) and Brown v. State, supra. New Mexico has no statute specifically authorizing a fine as a condition of probation.
The State also relies on State v. Walker, 27 N.C. App. 295, 219 S.E.2d 76 (1975). Walker states that imposition of a fine as a "special condition of probation was proper." No authority is cited in support of this statement; we are not told on what basis a fine may be imposed in North Carolina as a condition of probation.
What conditions of probation have been authorized in New Mexico? Section 40A-29-17, N.M.S.A. 1953 (2d Repl.Vol. 6) provides that when the district court has deferred sentence "it shall order the defendant to be placed on probation for all or some portion of the period of deferment * * * if the defendant is in need of supervision, guidance or direction that is feasible for the probation service to furnish * * *." The decisions conflict as to whether probation is a mandatory consequence of a deferred sentence. Compare State v. Serrano, 76 N.M. 655, 417 P.2d 795 (1966) and State v. Atencio, 85 N.M. 484, 513 P.2d 1266 (Ct.App. 1973) with State v. Holland, 78 N.M. 324, 431 P.2d 57 (1967) and State v. Soria, 82 N.M. 509, 484 P.2d 351 (Ct.App. 1971). The question of whether probation is mandatory under § 40A-29-17, supra, is not an issue in this case because the judgment deferring sentence specifically placed defendant on probation.
The conditions authorized for probation under a deferred sentence are stated in § 40A-29-18, N.M.S.A. 1953 (2d Repl.Vol. 6). The statute reads:

Conditions of order deferring or suspending sentence.  The district court shall attach to its order deferring or suspending sentence such reasonable conditions as it may deem necessary to ensure that the defendant will observe the laws of the United States, the various states and the ordinances of any municipality. The defendant upon conviction may be required:
A. to pay the actual costs of his probation service not exceeding two hundred dollars ($200) annually in one [1] or several installments;
B. to make restitution or reparation to aggrieved parties for actual damages or loss caused by the crime for which conviction was had;
C. to provide for the support of any persons for whose support he is legally responsible;
D. to undergo available medical or psychiatric treatment and to enter and remain in a specified institution, when required for that purpose;
E. to be placed on probation under the supervision, guidance or direction of probation authorities for a term not to exceed that of the maximum sentence prescribed by law for the commission of the crime for which he was convicted; and

*608 F. to satisfy any other conditions reasonably related to his rehabilitation.
The only portion of this statute which, arguably, could authorize a fine as a condition of probation is Paragraph F  conditions reasonably related to rehabilitation. However, to be reasonably related to rehabilitation, the probation condition must be relevant to the offense for which probation was granted. People v. Lent, 15 Cal. App.3d 481, 124 Cal. Rptr. 905, 541 P.2d 545 (1975); People v. Hyatt, 18 Cal. App.3d 618, 96 Cal. Rptr. 156 (1971); State v. Sandoval, 92 Idaho 853, 452 P.2d 350 (1969); compare People v. Mahle, 57 Ill.2d 279, 312 N.E.2d 267 (1974); Watson v. State, 17 Md. App. 263, 301 A.2d 26 (1973). Although not involving Paragraph F, see State v. Martinez, 84 N.M. 295, 502 P.2d 320 (Ct.App. 1972).
If § 40A-29-18(F), supra, should be construed as authorizing a fine as a condition of probation, the fine was not relevant to the cocaine offense. The trial court imposed the fine because of traffic offenses defendant committed as a juvenile. Defendant was 25 years of age at the time he was placed on probation. The fine would be void even if authorized by § 40A-29-18(F), supra.
The fine, however, was not authorized by § 40A-29-18(F), supra. A fine is "imposed as a punishment for a public crime for which the criminal has been tried and convicted." Territory of New Mexico v. Baca, 2 N.M. (Gild.) 183 (1882). See Commissioner of Motor Vehicles v. Lee, supra. Thus, by definition, a fine differs from a condition designed to rehabilitate a probationer. See State v. Baca, 90 N.M. 280, 562 P.2d 841 (Ct.App. 1977). A fine for the cocaine offense was authorized, but was barred by the plea bargain approved by the trial court. There was no other crime for which a fine could be imposed as punishment.
The Legislature not having authorized a fine as a condition of probation, the trial court had no authority to impose the fine. The judgment is affirmed; however, the cause is remanded with instructions to delete from the judgment the $3,000.00 fine imposed as a condition of probation. See State v. Hovey, supra.
IT IS SO ORDERED.
HERNANDEZ and LOPEZ, JJ., concur.
