We address here the question whether a person held in prison beyond the end of his sentence is a prisoner within the meaning of G. L. c. 123A, § 12(6), and conclude that he is not.
The defendant was convicted by a jury in 1993 of two counts of indecent assault and battery on a child under the age of fourteen, in violation of G. L. c. 265, § 13B; and one count of rape of a child, in violation of G. L. c. 265, § 23. He was sentenced to from five to ten years on each of the indecent assault and battery convictions, to be served concurrently with the rape sentence, which was from nine to fifteen years. The defendant’s sentence also included an order that he receive credit for time “spent in confinement prior to such sentence awaiting and during trial.” *863This credit was required by G. L. c. 279, § 33A,1 which also provides that the credit be ordered at the time sentence is imposed. Although the credit was ordered and was calculable at the time of sentencing (and amounted to fifty-eight days), it was not calculated or applied at that time. Because of a clerical error, the mittimus failed to include the credit.
Almost fourteen years later, on June 6, 2007, the defendant filed a motion to correct the sentence in order to receive the time served credit he was due.2 This motion was allowed on June 12, 2007,3 and upon recalculation by the Department of Correction, it was discovered that the defendant’s sentence already had terminated on May 25, 2007. At oral argument, the Commonwealth acknowledged that, after May 25, 2007, the defendant was in custody solely as a result of a clerical error resulting from the fact that the mittimus did not include the time-served credit to which the defendant was entitled.
On June 13, 2007 (i.e., the day after the defendant’s motion to correct the sentence had been allowed, and almost three weeks after his sentence had ended), the Commonwealth filed a petition to have the defendant civilly committed as a sexually dangerous person (SDP) pursuant to G. L. c. 123A, § 12(A).4 Such petitions are to be filed when the Commonwealth determines that a prisoner is likely to be an SDP, as defined elsewhere in c. 123A. A *864“prisoner” for purposes of § 12(6) is “an individual who is either serving a criminal sentence or awaiting trial.” Commonwealth v. Gillis, 448 Mass. 354, 358-359 (2007). Defendants who have “completed their sentences and face[] no charges at the time of the petitions, are not ‘prisoners’ in the ordinary sense of the word, [and] they are not within the class of persons for whom G. L. c. 123A, § 12(6), authorizes SDP commitment.” Id. at 359. “The key operative fact of the statute is that SDP commitment is only available if the procedure is initiated before the termination of a period of criminal confinement; if it is not, the statute no longer applies.” Ibid.
The fact that a person is in State custody is not enough to make him a “prisoner” within the meaning of § 12(6). Indeed, the Supreme Judicial Court has held that the definition of “prisoner” contained in G. L. c. 125, § 1 (m), as appearing in St. 1972, c. 777, § 8 (which defines prisoners as those who are “placed in custody in a correctional facility in accordance with law”) is not to be used for G. L. c. 123A, § 12(6). Commonwealth v. Gillis, supra. Because c. 123A is a statute in derogation of liberty, it is to be narrowly construed so as to avoid “possible constitutional due process problems, [and to] ensure that individuals are not deprived of liberty without a clear statement of legislative intent to do so.” Id. at 357 (citation omitted). For this reason, the statute does not apply to those who are “not serving any sentence who have no criminal charges pending against them.” Id. at 362.
When the petition in this case was filed, the defendant was in the custody of the State solely as a result of a clerical error. Because he neither was serving a sentence nor awaiting trial, he was not a “prisoner” within the meaning of G. L. c. 123A, § 12(6). See id. at 359 (defendants who were in the Commonwealth’s custody as a result of involuntary civil commitment, but who had completed their criminal sentences, were not prisoners within the meaning § 12[6]). Accordingly, the Commonwealth’s petition properly was dismissed.
Judgment of dismissal affirmed.
General Laws c. 279, § 33A, as appearing in St. 1961, c. 75, provides: “The court on imposing a sentence of commitment to a correctional institution of the commonwealth, a house of correction, or a jail, shall order that the prisoner be deemed to have served a portion of said sentence, such portion to be the number of days spent by the prisoner in confinement prior to such sentence awaiting and during trial.”
The defendant states that he sought unsuccessfully for several years to have his sentence recalculated to take the credit into account. The record does not show the nature, extent, or timing of these efforts.
The Department of Correction (DOC) received the order on June 18, 2007. It promptly recalculated the sentence and issued a certificate of release on the same day.
The Commonwealth filed the petition after having been notified by the DOC of the defendant’s upcoming release. The record does not show when this notification was made; however, there is nothing to suggest that the DOC did not comply with the requirement that the notification be made six months before release. See G. L. c. 123A, § 12(a). Moreover, there is nothing to suggest that the Commonwealth could not have filed its petition before May 25, 2007.