
95 N.J. 582 (1984)
472 A.2d 559
STATE OF NEW JERSEY, PLAINTIFF-RESPONDENT AND CROSS-APPELLANT,
v.
DONALD CHAPMAN, DEFENDANT-APPELLANT AND CROSS-RESPONDENT.
The Supreme Court of New Jersey.
Argued December 13, 1983.
Decided March 22, 1984.
*585 John M. Apicella, Assistant Deputy Public Defender, argued the cause for appellant and cross-respondent (Joseph H. Rodriguez, Public Defender, attorney).
Debra L. Stone, Deputy Attorney General, argued the cause for respondent and cross-appellant (Irwin I. Kimmelman, Attorney General of New Jersey, attorney; Debra L. Stone and Audrey G. Cohen, Deputy Attorney General, of counsel and on the briefs).
The opinion of the Court was delivered by SCHREIBER, J.
The defendant pleaded guilty to kidnapping (N.J.S.A. 2C:13-1 b(1) and (2)) and aggravated sexual assault (N.J.S.A. 2C:14-2 a(6)). After explaining the potential sentences, including possible periods of parole ineligibility, the trial court accepted the pleas. The court ordered that defendant be examined at the Adult Diagnostic and Treatment Center at Avenel (Avenel) prior to sentencing in accordance with N.J.S.A. 2C:47-1.
The Avenel report determined that the defendant's conduct was characterized by a pattern of repetitive, compulsive behavior and recommended sentencing to Avenel for a program of specialized treatment for the defendant's mental condition. See N.J.S.A. 2C:47-3 a. In light of this recommendation, the trial court imposed a sentence of twenty years at Avenel with a minimum parole ineligibility period of ten years for the kidnapping and a concurrent sentence of twenty years at Avenel with a minimum parole ineligibility period of ten years for the aggravated sexual assault.
Before enactment of the New Jersey Code of Criminal Justice, N.J.S.A. 2C:1-1 to 2C:98-4 (the Criminal Code), the defendant had been convicted of abduction with intent to defile. The trial court concluded that the earlier conviction was substantially equivalent to the Criminal Code offense of sexual assault and that the present conviction for aggravated sexual assault was a *586 second sex offense. The court therefore imposed a fixed minimum sentence of parole ineligibility pursuant to N.J.S.A. 2C:14-6.
Upon appeal a majority of the Appellate Division panel remanded the cause to the trial court for resentencing. The Appellate Division held that the trial court could either sentence the defendant to Avenel with a mandatory five-year parole ineligibility term as a second sex offender pursuant to N.J.S.A. 2C:14-6 or sentence him to the custody of the Commissioner of the Department of Corrections (the Commissioner) with minimum parole ineligibility terms of up to one half of the fixed term sentences pursuant to N.J.S.A. 2C:43-6 b. 189 N.J. Super. 379 (1983). Judge Michels dissented in part. 189 N.J. Super. at 399. In his view any defendant sentenced to Avenel, whether or not a second or subsequent sex offender, could be subject to a minimum parole ineligibility term of up to one half of the fixed term sentence under the Criminal Code.
The State filed a notice of appeal under R. 2:2-1, there being a divided Appellate Division decision. The defendant, questioning the sentencing judge's authority to disregard the Avenel diagnostic report and to sentence the defendant to the custody of the Commissioner instead of Avenel, petitioned this Court for certification.
While the petition for certification was pending, the trial court held a limited resentencing hearing. It then modified the kidnapping sentence to provide that the defendant would be placed in the custody of the Commissioner for twenty years with a mandatory minimum period of parole ineligibility of ten years and with the "recommendation * * * that the Commissioner consider having the sentence served at Avenel."
We granted defendant's petition for certification. 94 N.J. 554 (1983). We hold that a defendant may be sentenced to Avenel with a mandatory minimum parole ineligibility period; that if the defendant is convicted of a second or subsequent sex offense, the mandatory minimum parole ineligibility term must be *587 at least five years; and that the trial court has the discretion, after receipt of the Avenel report recommending that the sentence be served there, to order that the defendant be sentenced to the custody of the Commissioner instead. We therefore reverse the judgment of the Appellate Division essentially for the reasons stated in Judge Michels' dissent.

I
At issue here is the interrelationship of sections of the Criminal Code with each other and with N.J.S.A. 30:4-123.51 of the Parole Act of 1979, N.J.S.A. 30:4-123.45 to -123.70 (the Parole Act).
N.J.S.A. 2C:14-2 describes the elements of an aggravated sexual assault and provides that it is a crime of the first degree. The same section also delineates the elements of a sexual assault, which is designated a crime of the second degree. N.J.S.A. 2C:14-3 defines aggravated criminal sexual contact, which is designated a crime of the third degree, and criminal sexual contact, a crime of the fourth degree. Generally, the terms of imprisonment are ten to twenty years for a crime of the first degree, five to ten years for a crime of the second degree, three to five years for a crime of the third degree, and a specific term not to exceed eighteen months for a crime of the fourth degree. N.J.S.A. 2C:43-6 a.[1] If the court is clearly convinced that the aggravating factors outweigh the mitigating factors, it may fix a minimum term, not to exceed one half of the term prescribed above, during which the defendant is not eligible for parole. N.J.S.A. 2C:43-6 b.
*588 Some sentencing provisions are applicable only to sentences involving sexual crimes. Under N.J.S.A. 2C:47-1, when a person has been convicted of such a crime, the person is to be referred to Avenel "for such period as shall be necessary to complete a physical and psychological examination." If the examination reveals that the "conduct was characterized by a pattern of repetitive, compulsive behavior, the court may, upon the recommendation" of Avenel, sentence the offender to Avenel "for a program of specialized treatment for his mental condition." N.J.S.A. 2C:47-3 a (emphasis added). The remaining provisions of N.J.S.A. 2C:47-3 read as follows:
b. In the event that the court shall sentence a person as provided herein, the court shall notwithstanding set the sentence in accordance with Chapters 43 and 44 of this code. [Chapter 43 refers to N.J.S.A. 2C:43-1 through -22.]
c. In lieu of incarceration, the court may, upon the written report and recommendation of the Adult Diagnostic and Treatment Center, place such person on probation with the requirement, as a condition of such probation, that he receive outpatient psychological treatment in a manner to be prescribed in each individual case.
d. If it shall appear from the report of such examination made of such person that the offender's conduct was not characterized by a pattern of repetitive, compulsive behavior, the court shall not impose sentence on such person as provided by this chapter. [Emphasis added.]
The Criminal Code specifically provides that if a person such as the defendant is convicted of aggravated sexual assault, a crime of the first degree, the term of incarceration imposed may be ten to twenty years. It is also clear, as both the majority and dissenting Appellate Division opinions acknowledged, that the trial court is not bound by the recommendation of Avenel that the sentence be served there. The court may sentence the defendant to the custody of the Commissioner irrespective of a recommendation that the defendant be sent to Avenel for specialized treatment.
Nothing in the Criminal Code proscribes a trial court from imposing a mandatory minimum parole ineligibility period when the defendant is sentenced to Avenel. The provisions relating to the Avenel examination, report, and sentencing expressly indicate the contrary. N.J.S.A. 2C:47-3 b, quoted *589 above, indicates that when the court sentences a person "as provided herein," that is, inclusive of the situation when the defendant is being sent to Avenel, the court shall nevertheless set the sentence in accordance with N.J.S.A. 2C:43-6 b (the provision authorizing a trial court to impose a minimum parole ineligibility term of up to one half of the total sentence) and the remainder of Chapter 43 of the Criminal Code. See State v. Johnson, 182 N.J. Super. 1, 4 (Resentencing Panel), rev'd on other grounds, 88 N.J. 26 (1981). This interpretation is buttressed by N.J.S.A. 2C:14-6, which mandates that, unless an extended term is involved, a sentence imposed for a second or subsequent sexual offense shall include "a fixed minimum sentence of not less than 5 years during which the defendant shall not be eligible for parole." [Emphasis added.] The legislative intent to tie in parole ineligibility periods with Avenel sentences for first offenders as well as second sex offenders sentenced to Avenel is manifest from those two provisions.
N.J.S.A. 2C:14-6 provides that the parole ineligibility term for second or subsequent sex offenders, whether or not sentenced to Avenel, must be "not less than five years." The court may, of course, fix a parole ineligibility term of more than five years for a second or subsequent sex offender after weighing the aggravating and mitigating factors pursuant to N.J.S.A. 2C:43-6 b. However, N.J.S.A. 2C:43-6 b provides that the parole ineligibility term should not exceed one half of the fixed sentence. Therefore, if the total fixed sentence for a second or subsequent sex offender is greater than ten years, the court must impose a parole ineligibility term of at least five years and at most one half of the total sentence, depending upon the aggravating and mitigating factors. If the total fixed sentence for a second or subsequent sex offense is ten years or less, both the minimum and maximum parole ineligibility terms will be five years.
Permitting the trial court to impose a period of parole ineligibility with Avenel sentences serves a rehabilitative as well as a *590 punitive function. The trial court has the discretion in the first instance to sentence the defendant to prison instead of Avenel. Without the assurance of a minimum parole eligibility term, trial courts would be induced to direct defendants in need of special treatment to prison rather than to Avenel. The trial court in the instant case expressed this thought at sentencing, stating:
If I felt that I did not have the authority to impose a minimum period of ineligibility [at Avenel], I would not permit this defendant to go to the Diagnostic Center. I would confine him to Trenton State Prison because there I could impose a fixed period of minimum ineligibility and I would have some certainty that for some period of time at least the public could be protected from this defendant.

II
The Appellate Division reasoned that the Parole Act modified the sentencing structure in the Criminal Code. This thesis starts with the undisputed proposition that the Criminal Code in N.J.S.A. 2C:43-9 provides that "[r]elease of offenders or parole, recommitment and reparole after revocation shall be governed by the `Parole Act of 1979.'" The rationale is then predicated upon an analysis of N.J.S.A. 30:4-123.51 of the Parole Act. That section provides for conditions for parole eligibility for various categories of inmates.[2] Subsection e of that section states that each adult sentenced to Avenel:

*591 shall become primarily eligible for parole upon recommendation by the special classification review board pursuant to N.J.S. 2C:47-5, except that no such inmate shall become primarily eligible prior to the expiration of any mandatory or fixed minimum term imposed pursuant to N.J.S. 2C:14-6 [the mandatory minimum five-year parole ineligibility provision for second and subsequent sex offenders].
The majority argued that, since other subsections of N.J.S.A. 30:4-123.51 refer to nonreduction of "any judicial or statutory mandatory minimum term," the absence of comparable language in subsection e indicates that an Avenel sentence cannot be burdened by a minimum parole ineligibility term under N.J.S.A. 2C:43-6 b. This rationale assumes that the Parole Act implicitly modified the statement in N.J.S.A. 2C:47-3 b that sentencing for criminals referred to Avenel will continue to be governed by chapters 43 and 44 of the Criminal Code. We disagree.
The Legislature has sharply modified the philosophy of the original Sex Offender Act, N.J.S.A. 2A:164-3 to -13 (repealed by the Code), in the new Criminal Code. Under the Sex Offender Act, the primary purpose of sentencing was rehabilitation; the defendant was therefore to be released upon completion of successful treatment and not to be punished thereafter. State v. Clark, 65 N.J. 426, 430-36 (1974). The Criminal Code, on the other hand, calls for sentencing judges to impose determinate *592 sentences for sex offenses in accordance with the Criminal Code's general sentencing provisions. The Code recognizes that sex offenders, in addition to being treated for psychological problems, should be punished for their wrongful acts. Thus, for example, the Criminal Code would permit sentencing a sex offender to consecutive Avenel and prison terms for sex-related and nonsex-related charges arising from a single incident. Cf. State v. Clark, 65 N.J. 426 (1974) (holding that Sex Offender Act precluded imposition of consecutive Avenel and prison terms). In addition, under the philosophy of the Criminal Code, a defendant who received concurrent Avenel and prison sentences and who was released from Avenel before the end of the prison term could be required to serve the remainder of his concurrent term in prison.
There would appear to be an inconsistency between the Criminal Code provision authorizing courts to set mandatory minimum parole ineligibility terms and the Parole Act provision permitting defendants sentenced to Avenel to be paroled upon the recommendation of a special review board. However, we do not find the two provisions irreconcilable.[3] The Parole Act provides that an adult sentenced to Avenel may become eligible for parole upon recommendation by the special classification review board. N.J.S.A. 30:4-123.51 e. The Criminal Code contemplates that if such a recommendation were made before expiration of a previously fixed parole ineligibility term, the matter should be brought before the court for modification of the original sentence. N.J.S.A. 2C:47-4 c, which governs this situation, reads as follows:
If, in the opinion of the commissioner [of the Department of Corrections], upon the written recommendation of the Special Classification Review Board continued confinement is not necessary, he shall move before the sentencing court for modification of the sentence originally imposed.
*593 Moreover, it would appear that upon such modification a person committed to Avenel could not be released under parole supervision until it appeared "to the satisfaction of the State Parole Board" that such parole was appropriate. N.J.S.A. 2C:47-5.
The court's authority to modify sentences of persons confined at Avenel under N.J.S.A. 2C:47-4 c is subject to the limitation that a second or subsequent sex offender must receive a fixed minimum parole ineligibility term of not less than five years under N.J.S.A. 2C:14-6. The Parole Act recognizes this limitation. It provides that, despite the possible parole recommendation of the special classification review board, no "inmate shall become primarily eligible" for parole prior to the expiration of the mandatory five-year parole ineligibility term "imposed pursuant to N.J.S. 2C:14-6." N.J.S.A. 30:4-123.51 e. We subscribe fully to Judge Michels' comment that the "exercise of [the limited sentence modification] power [under N.J.S.A. 2C:47-4 c] is consistent with the legislative objectives of both the Code and the 1979 Parole Act, which require sentencing in accordance with the requirements of chapters 43 and 44 of the Code but endeavor to retain the rehabilitative benefits afforded by a program of specialized treatment at Avenel." 189 N.J. Super. at 403.
In summary, after receiving an Avenel report recommending that a sex offender be treated at Avenel, a trial court has the option to sentence the defendant either to Avenel or to the custody of the Commissioner. In either event, if the defendant is a first sex offender, the trial court may fix a mandatory minimum parole ineligibility term of up to one half of the total sentence pursuant to N.J.S.A. 2C:43-6 b if it is clearly convinced that the aggravating factors outweigh the mitigating factors. If the defendant is a second or subsequent sex offender, the court must fix a parole ineligibility term of at least five years under N.J.S.A. 2C:14-6, and at most one half of the total fixed sentence under N.J.S.A. 2C:43-6 b, provided that the total fixed sentence is ten years or more.
*594 When the defendant is a first sex offender and is sentenced to Avenel with a minimum parole ineligibility term, the special classification review board may determine before expiration of the parole ineligibility term that "continued confinement is not necessary." N.J.S.A. 2C:47-4 c. Similarly, when the defendant is a second or subsequent sex offender but is sentenced to Avenel with a parole ineligibility term in excess of the five-year minimum, the special classification review board may recommend release before the end of the parole ineligibility term, though not before the termination of the first five years. In either case, if the Commissioner is satisfied with the recommendation, the Commissioner shall apply to the sentencing court to modify the sentence imposed. After the sentence is modified, the matter would be submitted to the State Parole Board.

III
When the facts and circumstances of this case are considered in the light of the Criminal Code's expressed sentencing policy, the trial court's decision to impose ten-year mandatory minimum parole ineligibility periods is fully warranted. The crime occurred on July 12, 1980 at approximately 5:00 p.m. S.Z., age 23, had taken her ten-speed Ross bicycle and headed south for a leisurely ride on Clinton Road in the Township of West Milford. Approximately one mile past the Terrace Pond parking area, she observed a male, later identified as defendant, walking towards her on the roadway. As defendant signaled for her to stop, she slowed down. Defendant suddenly grabbed S.Z. off her bicycle, put his hand over her mouth and dragged her into the woods, where he laid her on the ground and tied her hands with some rope that he had taken out of a brown zippered case. Defendant then returned to the roadway to throw the victim's bicycle into a bush, came back to the woods and gagged S.Z.'s mouth. He forced her to walk through the woods to a blue pick-up truck and made her lie down on a mat in the bottom of the truck's bed. He then drove off with her.
*595 Defendant took the victim to a secluded road off of Route 515, approximately two miles from the Route 23 intersection. There, in a wooded area, defendant forced S.Z. to lie on the ground, tied her hands and feet to two trees and taped her mouth. He instructed her not to try to get free or she would regret it since he had a knife. He then walked back to his truck and drove off, leaving her there for about two or three hours. During that time he returned to his home for "torture equipment" and for a pick and shovel, which he intended to use to dig her grave.
When defendant returned to the wooded area, it was already dark. He untied S.Z. and marched her to another location near a lake. He again tied her hands to a tree, "spread eagle-style," while she lay on the ground. He then stripped her from the waist down, performed a number of sexual abominations on her and compelled her to submit to intercourse.
When defendant finally ceased his brutalization of the young woman, he apologized and told her that he needed help. He drove her back through the dirt road to the main road, stopped to retrieve her bicycle from the woods and eventually let her out in the area of Greenwood Turnpike. S.Z. then got on her bicycle and pedaled to the Queen of Peace Church, where she called for help.
The following day defendant turned himself in to the Midland Park Police Department. Defendant's recitation of the facts surrounding the incident corroborated the account initially given to the police by the victim. In addition, defendant admitted that he had intended to torture his victim to death with the help of the equipment that he carried with him, but that he had backed out at the last minute and instead decided to release her. He also said that he had been planning the crime for some time.
The presentence report revealed that the defendant had a significant prior record. In 1972, while a juvenile, he was found guilty of breaking and entering. In 1973, he received two suspended six-month consecutive sentences as an adult for assault on a police officer and for drunk and disorderly conduct. *596 While on probation for those crimes, he was convicted of abduction with intent to defile and impairing the morals of minors after kidnapping three girls between the ages of nine and ten under circumstances very similar to those of the instant crime. He received an indeterminate sentence and was paroled after two years. He was subsequently convicted for possession of a switchblade knife and given a suspended sentence.
The trial court was clearly convinced that the aggravating factors substantially outweighed the mitigating factors. In reaching that conclusion, it did not abuse its discretion. The court was therefore justified in deciding that confinement and punishment as well as treatment were indicated and that concurrent ten-year parole ineligibility terms for the kidnapping and aggravated sexual assault were appropriate. A major purpose of our criminal law is to protect society from behavior endangering the public safety. The measures adopted by the Criminal Code to safeguard the public include restraining and isolating criminals while treating and punishing them.
The trial court had modified its original kidnapping sentence to conform with the Appellate Division's mandate. The trial court's action in this respect reflected its reaction to that determination. Since we find that the Appellate Division erred, it is appropriate that the initial sentencing determinations, which we find were proper, be reinstated.
The judgment of the Appellate Division is reversed and the cause is remanded to the trial court to reenter the original sentences.
For reversal and remandment  Chief Justice WILENTZ and Justices CLIFFORD, SCHREIBER, HANDLER, POLLOCK, O'HERN and GARIBALDI-7.
For modification  None.
NOTES
[1]  Of course, courts are guided in sentencing by presumptive sentences. N.J.S.A 2C:44-1 f. In addition, terms may vary depending upon the aggravating and mitigating factors, N.J.S.A. 2C:44-1a and -1b, and a defendant may be sentenced to an extended period of incarceration if one of several offender-related criteria is satisfied, N.J.S.A 2C:43-7 and 2C:44-3. See discussion in State v. Roth, 95 N.J. 334 (1984).
[2]  N.J.S.A. 30:4-123.51 reads in pertinent part as follows:

a. Each adult inmate sentenced to a specific term of years at the State Prison * * * shall become primarily eligible for parole after having served any judicial or statutory mandatory minimum term, or one third of the sentence imposed where no mandatory minimum term has been imposed less commutation time for good behavior * * * and credits for diligent application to work and other institutional assignments * * *. Consistent with the provisions of the New Jersey Code of Criminal Justice (N.J.S. 2C:11-3, 2C:14-6, 2C:43-6, 2C:43-7), commutation and work credits shall not in any way reduce any judicial or statutory mandatory minimum term and such credits accrued shall only be awarded subsequent to the expiration of the term.
b. Each adult inmate sentenced to a term of life imprisonment shall become primarily eligible for parole after having served any judicial or statutory mandatory minimum term, or 25 years where no mandatory minimum term has been imposed less commutation time for good behavior and credits for diligent application to work and other institutional assignments. * * * Consistent with the provisions of the New Jersey Code of Criminal Justice (N.J.S. 2C:11-3, 2C:14-6, 2C:43-6, 2C:43-7), commutation and work credits shall not in any way reduce any judicial or statutory mandatory minimum term and such credits accrued shall only be awarded subsequent to the expiration of the term.
* * * * * * * *
e. Each adult inmate sentenced to the Adult Diagnostic and Treatment Center, Avenel, shall become primarily eligible for parole upon recommendation by the special classification review board pursuant to N.J.S. 2C:47-5, except that no such inmate shall become primarily eligible prior to the expiration of any mandatory or fixed minimum term imposed pursuant to N.J.S. 2C:14-6.
[3]  Even if they were, the Code provisions would govern. The Parole Act provides that in the case of inconsistency, "no provisions of the New Jersey Code of Criminal Justice shall be superseded hereby." N.J.S.A. 30:4-123.69.
