— Appeal from a judgment of the Supreme Court at Special Term (Torraca, J.), entered July 12, 1982 in Ulster County, which dismissed a proceeding for a writ of habeas corpus, without a hearing. As a 15 year old, Derrick Roberts was arrested and indicted under the Juvenile Offender Law (see Penal Law, § 10.00, subd 18; CPL 1.20, subd 42, as added by L 1978, ch 481, § 8, amd by L 1979, ch 411, § 7) for murder in the second degree. Bail was set at $25,000. Unable to meet bail in this amount, Roberts spent from March, 1980 to November, 1980 in a juvenile detention center awaiting trial. In November, 1980, bail was reduced to $2,500, which Roberts met; and he remained free on bail until November, 1981, when he was convicted of manslaughter in the first degree and sentenced to two and one-third to seven years, to be served in a secure facility of the Division for Youth, and commenced serving his sentence. Thereafter, on May 6, 1982, petitioner Michael W. Warren, an attorney, brought his habeas corpus proceeding seeking Roberts’ release on the ground that his pretrial detention in 1980 was illegal. Special Term dismissed the petition as moot, and this appeal followed. We affirm Special Term’s dismissal of the petition. “It is well settled that the remedy of habeas corpus is available only to one who is entitled to immediate release from the custody he is challenging” (People ex rel. Malinowski v Casscles, 53 AD2d 954, opp dsmd 40 NY2d 989; see, also, People ex rel. Lane v Vincent, 32 NY2d 940; People ex rel. Artese v New York State Bd. of Parole, 54 AD2d 1047, 1048). Roberts does not dispute that at the time the instant proceeding was initiated he was legally and properly held under his sentence as a convicted offender. Therefore, even if his pretrial detention were declared to have been unconstitutional, Roberts could not be released from his present incarceration. People ex rel. Wayburn v Schupf (39 NY2d 682) and People ex rel. Donohoe v Montayne (35 NY2d 221), relied upon by petitioner, are clearly distinguishable from the instant case. In Wayburn, a 15-year-old youth, while being held in pretrial detention, brought a habeas corpus proceeding challenging as unconstitutional a provision of the Family Court Act which authorized such pretrial detention. Donohoe concerned a petitioner who likewise initiated a habeas corpus proceeding while being held in prison following revocation of parole and challenged the basis of that revocation. Here, however, the habeas corpus proceeding challenging Roberts’ pretrial detention was not commenced during his eight-month period of pretrial detention, but instead was instituted some 18 months after his release from that detention. Once Roberts was released in November, 1980, habeas corpus was no longer an appropriate *680remedy to challenge his pretrial detention, and, therefore, an actual controversy from which relief could be granted never existed here. Accordingly, the petition was properly dismissed, and it is unnecessary to reach any other issue. Judgment affirmed, without costs. Kane, J. P., Mikoll, Yesawich, Jr., Weiss and Levine, JJ., concur.