
343 Mass. 53 (1961)
175 N.E.2d 470
RICHARD E. STEARNS, PETITIONER.
Supreme Judicial Court of Massachusetts, Middlesex.
April 5, 1961.
June 20, 1961.
Present: WILKINS, C.J., SPALDING, WILLIAMS, WITTEMORE, & CUTTER, JJ.
Walter Powers, Jr., for the petitioner.
James W. Bailey, Assistant Attorney General, for the respondent.
WILLIAMS, J.
This is a petition to the Superior Court for the issuance of a writ of habeas corpus to be served on the superintendent of the Massachusetts Correctional Institution at Walpole, hereinafter called the respondent. It is alleged that the petitioner was arrested on or about January 9, 1946, and charged with assault with intent to murder and assault with a dangerous weapon. He was confined at the Middlesex County House of Correction and Jail at East Cambridge from January 10 to February 8, 1946, and then from February 8 to March 18, 1946, at the Metropolitan State Hospital for observation. Thereafter he was committed as insane and confined at Bridgewater State Hospital from March 18, 1946, to February 8, 1950. On that date he was returned to the jail at East Cambridge and *55 there confined to April 20, 1950, "awaiting trial." On April 20, 1950, he was sentenced by the Superior Court to serve fifteen to twenty years on each of two counts alleging assault with intent to murder and eight to ten years on each of two counts alleging assault with a dangerous weapon; all sentences to be served concurrently. On April 20, 1950, he was confined pursuant to these sentences in the State prison at Charlestown and is now confined in the Massachusetts Correctional Institution at Walpole. The respondent is "detaining and imprisoning" the petitioner and refuses to release him. He "has refused to reduce his sentences by the number of days he was in Bridgewater State Hospital from March 18, 1946, through February 8, 1950." It is asserted that such reduction is required by G.L.c. 127, § 129B, inserted by St. 1960, c. 350, and that if the time spent in the Bridgewater State Hospital were deducted from the sentences the petitioner "would be entitled and is entitled to immediate release and discharge."
The Attorney General filed an "answer" in which the respondent admitted the factual allegations of the petition but denied that the petitioner was entitled to the requested reduction.
The petition was denied and the petitioner appealed to this court.
It is plain from the petition that the petitioner is imprisoned or restrained by virtue of a warrant or other process. A copy thereof should have been annexed to the petition (G.L.c. 248, § 3) and would have disclosed that in fact the petitioner is serving sentences not for assault with intent to murder, c. 265, § 15, but for assault with intent to murder, being armed, c. 265, § 18, and not for assault with a dangerous weapon, c. 265, § 15B, but for assault and battery with a dangerous weapon, c. 265, § 15A. The sentences awarded for these offences were correct.
In support of his claim for a reduction of the sentences the petitioner cites G.L.c. 127, § 129B, inserted by St. 1960, c. 350. That statute provides, "The sentence of any prisoner in any correctional institution in the commonwealth, *56 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."[1] It supplements G.L.c. 279, § 33A, inserted by St. 1955, c. 770, § 101, as amended by St. 1958, c. 173,[2] which provides that on imposing sentence of commitment the court 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 basic point at issue is whether the petitioner while confined in the Bridgewater State Hospital from March 18, 1946, to February 8, 1950, was "held in custody awaiting trial." There can be no doubt that § 129B applies to the time spent in jail between the day of arrest and the day the indictment was reached for trial. We see no reason why the statute should not apply as well to the time before trial that an insane prisoner held on criminal process spends in a mental hospital pending his restoration to sanity. He is in custody and is awaiting trial. If he were committed to the hospital after he had started to serve his sentence his time there spent would be credited on his sentence. Le Donne, petitioner, 173 Mass. 550. See G.L.c. 123, § 105, and G.L.c. 127, §§ 116, 119. We think the petitioner is entitled to the reduction of sentence which he seeks.
He contends that if credited with such reduction he will have fully served his sentences and that he is entitled to be discharged from imprisonment. G.L.c. 127, § 129. This contention raises the question whether habeas corpus is available to him and if so what relief can be afforded him on the present petition. It is provided by G.L.c. 248, § 1, that "Whoever is imprisoned or restrained of his liberty *57 may, as of right and of course, prosecute a writ of habeas corpus... unless  First, He has been committed for ... felony ... [and] Second, He has been convicted or is in execution upon legal process, civil or criminal." The petitioner has been committed for felony and is in execution upon legal process. He is therefore not entitled to a writ as matter of right. Belgard v. Morse, 2 Gray, 406. See Sims's Case, 7 Cush. 285, 293. The Supreme Judicial Court, however, has power to issue the writ in its discretion regardless of the exceptions. § 25. Feeley's Case, 12 Cush. 598, 599-600. By G.L.c. 213, § 1A, inserted by St. 1939, c. 257, § 1, as amended, "original jurisdiction, concurrently with the supreme judicial court, of all proceedings relating to habeas corpus" was conferred on the Superior Court. This grant of jurisdiction necessarily included the discretionary power to issue the writ. The instant petition for the writ was properly presented to the Superior Court. We think sufficient facts were stated in the petition to warrant the granting of the writ. If brought before the court the petitioner could show the reductions in his sentences to which he is entitled for good conduct and good work. See Gildea v. Commissioner of Correction, 336 Mass. 48; Comerford v. Commissioner of Correction, 335 Mass. 714. There is probable cause to believe that these reductions when computed by the correction authorities plus the reduction to which we are herein ruling the petitioner is entitled will demonstrate that he is presently entitled to a discharge. See West's Case, 111 Mass. 443.
Since doubt has been expressed as to whether exceptions lie to rulings at a hearing on a petition for a writ of habeas corpus (see Chambers's Case, 221 Mass. 178) and as similar doubt might apply to an appeal, we think it appropriate to hold that in the circumstances the petitioner had a right to appeal and that his appeal is properly before us. In Chambers's Case, at page 179, it was stated that the reason for doubt is that the purpose of the writ is to try forthwith the right of a person to his liberty and "it might be inconsistent with its purpose" if its granting could be delayed by exceptions. *58 The petition was brought in the Supreme Judicial Court and it was said "[t]he usual course has been for the presiding justice to reserve, report or adjourn cases into the full court where its determination ought to be had."
The present case is an appeal by a person alleged to be unlawfully restrained of his liberty from the denial of his petition by a judge of the Superior Court. The appeal will result not in delaying but in speedily determining the question of his right to be at liberty. It is provided by G.L.c. 231, § 96, that a party aggrieved by any order of the Superior Court "decisive of the case founded upon matter of law apparent on the record in any proceeding, may appeal therefrom to the supreme judicial court." The denial of the petition was such an order. See Klier v. Building Inspector of Lawrence, 333 Mass. 111, 112-113. It was decisive of the right of the petitioner to a reduction of sentence upon which his right to an immediate discharge may well depend and appears to have been founded on an erroneous concept of the scope of § 129B. There is nothing in the record to suggest that the petition was denied as an exercise of discretion.
We think that in view of this opinion the petitioner should be afforded a rehearing. We therefore reverse the order denying the petition. See Gentile, petitioner, 339 Mass. 319, 322.
So ordered.
NOTES
[1]  The statute has been extended by St. 1961, c. 74, to include a prisoner in any house of correction or jail.
[2]  See now St. 1961, c. 75.
