
396 So.2d 1128 (1981)
Robert O'MALLEY, Petitioner,
v.
STATE of Florida, Respondent.
No. 59280.
Supreme Court of Florida.
April 2, 1981.
Robert O'Malley, in pro. per., for petitioner.
Jim Smith, Atty. Gen., and Doris E. Jenkins, Asst. Atty. Gen., Tallahassee, for respondent.
ADKINS, Acting Chief Justice.
This case is here on a writ of habeas corpus to decide whether Robert O'Malley was invalidly sentenced because he was declared a mentally disordered sex offender in accordance with chapter 917, Florida Statutes (1975), before sentence was imposed. We have jurisdiction. Art. V, § 3(b)(9), Fla. Const. (1980).
O'Malley is incarcerated pursuant to judgments and sentences entered for two counts of false imprisonment, one count of lewd and lascivious act in the presence of a female child under the age of fourteen years, and one count of handling and fondling a male child under the age of fourteen years. Sentence imposed in the false imprisonment charge was to be served concurrently with sentence imposed for the charge of lewd and lascivious acts in the presence of a female child under the age of fourteen years. The sentence imposed for handling and fondling a male child under the age of fourteen years was to run consecutive to the other sentences.
Petitioner O'Malley was committed to the custody of the Department of Offender Rehabilitation, Division of Mental Health Services, pursuant to chapter 917, Florida Statutes, for treatment and rehabilitation. Thereafter, petitioner was to begin serving fifteen years for false imprisonment and lewd and lascivious acts in the presence of a *1129 female child under the age of fourteen years. Upon completion of that time of imprisonment, petitioner would then begin serving a ten-year sentence for his fourth conviction.
The sentences were imposed April 15, 1976. O'Malley completed treatment in November, 1976, and has been transferred to the Department of Corrections. He says that the sentence was unlawful in that it was imposed prior to the completion of the treatment. We agree.
The intent of chapter 917, Florida Statutes, is to provide treatment and rehabilitation for one determined to be a mentally disordered sex offender. Upon completion of the psychiatric treatment, petitioner O'Malley should have been brought before the court for recommencement of the criminal proceedings. At that time, the court would have an opportunity to take into consideration the extent which such treatment should affect the sentence imposed.
In Gammill v. Wainwright, 357 So.2d 714 (Fla. 1978), the trial court sentenced Gammill following a guilty plea to 35-year prison terms on two kidnapping offenses, immediately after determining petitioner to be a mentally disordered sex offender. We held that the trial judge failed to follow the correct procedure, and thereby frustrated the purpose of chapter 917, Florida Statutes. In Gammill we vacated the sentence and remanded petitioner to the trial court for proper disposition.
It is the same here. The sentences imposed upon petitioner are vacated. O'Malley shall be brought before the Circuit Court of the Sixth Judicial Circuit in Pinellas County for imposition of appropriate sentences. The court should consider any rehabilitative effect the treatment of O'Malley has had on him, giving effect to the treatment purpose of this statute.
Petitioner is entitled to neither a discharge nor a new trial, only a resentencing.
It is so ordered.
BOYD, OVERTON, ENGLAND and ALDERMAN, JJ., concur.
