Appeal from a judgment (denominated order and judgment) of the Supreme Court, Oneida County (Bernadette T. Romano, J.), entered August 14, 2009. The judgment denied and dismissed the petition for a writ of habeas corpus.
It is hereby ordered that the judgment so appealed from is unanimously affirmed without costs.
Memorandum: In appeal No. 1, petitioner appeals from a judgment dismissing his petition seeking habeas corpus relief with respect to his civil commitment to Central New York Psychiatric Center pursuant to Mental Hygiene Law article 10 following his release from Livingston Correctional Facility. According to petitioner, he was not a detained sex offender within the meaning of article 10 when the proceeding pursuant to that article was commenced because he was not “a person who [was] in the care, custody, control, or supervision of an agency with jurisdiction” at that time (§ 10.03 [g]). Indeed, the record establishes that, at that time, petitioner was in fact illegally incarcerated for violating the terms of a period of postrelease supervision that had been improperly imposed after he had completed serving his determinate term of imprisonment. Petitioner thus is *1654correct that the period of postrelease supervision, and thus the term of imprisonment resulting from his violation thereof, was a legal nullity (see People v Williams, 14 NY3d 198, 217 [2010], cert denied 562 US —, 131 S Ct 125 [2010]; People v Appleby, 71 AD3d 1545 [2010]). Nevertheless, we affirm the judgment in appeal No. 1 because, for the purposes of article 10, “[t]he legality of [petitioner’s] custody is irrelevant” (People ex rel. Joseph II. v Superintendent of Southport Correctional Facility, 15 NY3d 126, 134 [2010], rearg denied 15 NY3d 847 [2010]).
In appeal No. 2, petitioner appeals from a judgment dismissing his petition for a writ of habeas corpus with respect to his commitment to the Livingston Correctional Facility. We conclude that the appeal must be dismissed as moot, inasmuch as petitioner was released from imprisonment there upon the commencement of his civil commitment (see generally People ex rel. Hampton v Dennison, 59 AD3d 951 [2009], lv denied 12 NY3d 711 [2009]). Present — Martoche, J.P, Lindley, Sconiers, Pine and Gorski, JJ.