
213 A.2d 519 (1965)
David B. LONGWAY
v.
STATE of Maine et al.
Supreme Judicial Court of Maine.
October 19, 1965.
Frederick T. McGonagle, Portland, for plaintiff.
Richard J. Dubord, Atty. Gen., and John W. Benoit, Asst. Atty. Gen., Augusta, for defendant.
RUDMAN, Justice.
On appeal, from a decision by the Superior Court, discharging the writ of habeas corpus.
The appellant was tried in January, 1962, before a jury on an indictment in which he was charged with the crime of larceny of a motor vehicle. He was represented by court appointed counsel, found guilty of a crime as charged and sentenced to State Prison for a term of not less than one year nor more than two years. He did not appeal and commenced serving his sentence on July 19, 1963, which was satisfied on February 12, 1965.
He is now serving a sentence of two and one-half to six years for escape, which commenced at the expiration of the larceny sentence.
The pertinent section of the statute governing post-conviction habeas corpus petitions, 14 M.R.S.A. § 5502, provides:
"Any person convicted of the crime and incarcerated thereunder * * * who claims that he is illegally imprisoned * * * may institute a petition for a *520 writ of habeas corpus seeking a release from an illegal imprisonment * * *." (Emphasis supplied.)
The purpose of the statute was to inquire into the legality of the detention. The petitioner's present detention in State Prison is not in execution of the sentence imposed for the crime of larceny; that sentence has been served and the petitioner is no longer held thereunder. There is nothing upon which the writ of habeas corpus in this case can operate. McNally v. Hill, 293 U.S. 131, 55 S.Ct. 24, 79 L.Ed. 238.
He is not "incarcerated" under the larceny conviction nor "illegally imprisoned" thereunder.
In Good v. State, 240 Md. 1, 212 A.2d 487, 494, the court said:
"We note that relief * * * is not available to appellant since she is not incarcerated or under probation or parole. If the truth of the allegations in the appellant's petitions be assumed, it would appear that there is no adequate judicial remedy for the wrong of which the appellant complains, but, as was said in Keane v. State, 164 Md. 685, 694, 166 A. 410, (1933), `this court cannot create a remedy where none exists, since its function is to discover and apply existing law and not to make new law.'"
In Ex parte Baez, 177 U.S. 378, 390, 20 S.Ct. 673, 677, 44 L.Ed. 813, the court said:
"It is well settled that this court will not proceed to adjudication where there is no subject-matter on which the judgment of the court can operate."
This principle was applied in Weber v. Squier, 315 U.S. 810, 62 S.Ct. 800, 86 L.Ed. 1209; Tornello v. Hudspeth, 318 U.S. 792, 63 S.Ct. 990, 87 L.Ed. 1158; Zimmerman v. Walker, 319 U.S. 744, 63 S.Ct. 1027, 87 L.Ed. 1700.
A petitioner's right to attack his sentence under Section 5502, supra, exists, by the terms of the statute, only when he is "incarcerated" under the sentence imposed, and is not available to a petitioner who is no longer restrained for that reason.
The appellant is not now engaged in serving the sentence at which his petition under Section 5502, supra, is directed. His present confinement is on a sentence for escape. He has satisfied the sentence imposed for larceny and any issue sought to be raised with respect to the trial upon the larceny indictment is of course now moot. United States v. Brest, 266 F.2d 879, 881 (3rd Cir.); Heflin v. United States, 358 U.S. 415, 418, 79 S.Ct. 451, 3 L.Ed.2d 407; Perry v. United States, 314 F.2d 52 53 (8th Cir.); Buckner v. Hudspeth, 105 F.2d 393, 395 (10th Cir.).
We have carefully reviewed the record of the jury trial and the post-conviction habeas corpus proceedings. We are satisfied that were this case before us on its merits the result would be the same. The petitioner was represented by competent counsel in both trials and the issues clearly presented and adjudicated. We find no error.
The entry will be,
Appeal dismissed.
SULLIVAN, J., did not sit.
