
344 Mass. 260 (1962)
182 N.E.2d 125
RUBIN NEEDEL, petitioner.
Supreme Judicial Court of Massachusetts, Suffolk.
April 2, 1962.
May 3, 1962.
Present: WILKINS, C.J., SPALDING, CUTTER, KIRK, & SPIEGEL, JJ.
Robert A. Curry, for the petitioner.
Theodore R. Stanley, Assistant Attorney General, for the respondents.
WILKINS, C.J.
This petition, originally to the county court, was transferred to the Superior Court. See G.L.c. 213, § 1A (as amended through St. 1941, c. 180); G.L. (Ter. Ed.) c. 214, § 32. It is loosely drawn. In substance it asks that a writ of habeas corpus issue to be served on the superintendent of the Massachusetts Correctional Institution at Walpole and on the commissioner of correction as respondents. There is no compliance with G.L. (Ter. Ed.) c. 248, § 3, requiring that "If the imprisonment or restraint is by virtue of a warrant or other process, a copy thereof shall be annexed," with exceptions not shown to be material.
The petition contains an allegation of law that the petitioner should have been released from custody on November 28, 1960. This is denied. It contains allegations of *261 fact, which the Attorney General concedes to be correct.[1] On November 12, 1957, the petitioner was taken into custody for a crime committed in Suffolk County on that date, and being unable to post bond or bail he was remanded to jail in the custody of the sheriff. On February 8, 1958, he was sentenced to the Massachusetts Correctional Institution at Walpole for a term of not more than six years and not less than four years. On October 16, 1959, he was released under parol conditions. On December 9, 1959, he was taken into custody by the State police, for a crime which was committed on August 30, 1957, and for which he had been secretly indicted in Essex County on January 16, 1958. He was brought to trial, found guilty, and on February 10, 1960, was sentenced to a term of not more than six years and not less than four years, to be served concurrently with the sentence for the Suffolk County crime. The Attorney General filed an "answer," which contained, in addition to other allegations, a denial that the petitioner is unlawfully held. See Vautier, petitioner, 340 Mass. 341, 343n. The petition was dismissed, and the petitioner appealed.
The "answer" of the Attorney General sets up that the petitioner is imprisoned upon legal criminal process, and that hence habeas corpus will not lie under G.L. (Ter. Ed.) c. 248, § 1. The petitioner concedes that he is not entitled to the writ as matter of right. Such a writ, however, may issue as matter of discretion. G.L. (Ter. Ed.) c. 248, § 25. We assume that, if the petitioner's contentions are correct, he is entitled to an immediate discharge. Stearns, petitioner, 343 Mass. 53, 57. We consider the petition as a suitable basis for considering the merits of the main question presented on this record. See Sims's Case, 7 Cush. 285, 291-293; Chamber's Case, 221 Mass. 178, 180-181. The appeal is here under G.L. (Ter. Ed.) c. 231, § 96.
The petitioner's contention is that the time he served *262 from February 8, 1958, should be accounted time in custody awaiting trial under G.L.c. 127, § 129B (inserted by St. 1960, c. 350),[1a] which reads: "The sentence of any prisoner in any correctional institution in the commonwealth, who was held in custody awaiting trial shall be reduced by the number of days spent by him in confinement prior to such sentence and while awaiting trial, unless the court in imposing such sentence had already deducted therefrom the time during which such prisoner had been confined while awaiting trial." Compare G.L.c. 279, § 33A (as amended through St. 1961, c. 75). The short answer is that the petitioner was not held "in custody awaiting trial" nor "in confinement prior to such sentence and while awaiting trial." He was in confinement pursuant to a sentence for an unrelated crime of which he had been convicted. The statutory purpose was not to allow deductions for time served under sentence for another crime, but was to afford relief to those not convicted and not serving any sentence but who because of inability to obtain bail, for example, were held in custody awaiting trial. In Stearns, petitioner, 343 Mass. 53, the petitioner was given credit for time spent in confinement as an insane prisoner at Bridgewater State Hospital. He had not then been convicted or sentenced for a crime.
Order dismissing petition affirmed.
NOTES
[1]  Minor discrepancies in dates between the petition and the respondents' brief need not be noticed at this time. Some of these are outside the present record.
[1a]  An amendment by St. 1961, c. 74, is immaterial.
