The primary question here presented is whether, under CPLR 7004(c), a writ of habeas corpus directed to the warden of a State prison may be made returnable and heard before a Justice of the Supreme Court in a county other than that in which the relator is detained.
The relator is presently serving a sentence of 25 to 40 years (as a parole violator) at Green Haven State Prison in Dutchess County, consequent upon his conviction on certain felony charges in the Supreme Court, New York County, in 1936. Some months ago he sued out a writ of habeas corpus from the Supreme Court, New York County, alleging, inter alia, that, when he appeared for sentence in 1936 he was not asked, as required by section 480 of the Code of Criminal Procedure, why judgment should not be pronounced against him.1 The writ was made returnable in New York County before the issuing justice who denied a motion by the district attorney to amend the writ by making it returnable in Dutchess County, the situs of the relator’s detention. The district attorney thereupon instituted this proceeding under article 78 of the CPLB. for a judgment in the nature of prohibition to restrain the issuing justice *333from holding a hearing’ on the writ in New York County, and to prohibit the warden from producing his prisoner there. The Appellate Division denied the application, and the appeal is in this court by our permission.
Prior to 1922, the pertinent statutes left it within the sound discretion of the issuing judge to determine whether a writ of habeas corpus should be made returnable outside the county in which the relator was detained (See Code Civ. Pro., § 2023 [L. 1880, ch. 178]; Civ. Prae. Act, § 1239, subd. 2 [L. 1920, ch. 925]; see People ex rel. Van Buren v. Superintendent, 118 Misc. 145.) However, in order to obviate the administrative, security and financial burdens entailed in requiring prison authorities to produce inmates pursuant to such writs in a county other than that in which they were detained, the statute was amended in 1922, on recommendation of the Attorney-G-eneral and the Superintendent of Prisons, so as to make special provision for writs directed to those in charge of State prisons or other State institutions. The new legislation (Civ. Prac. Act, § 1239, subd. 3, as added by L. 1922, ch. 187) mandated that “All writs of habeas corpus directed to the * * * warden of a state prison, or the superintendent * * * of a state institution, must be made returnable before a * * * [judge] in the county in which the person is detained ’ ’, unless there was no such judge “ in the county capable of acting ”, in which event the writ was to be made returnable before the nearest accessible judge “ in an adjoining county ”. This language was thereafter uniformly interpreted as requiring that, under normal circumstances, a writ sued out by an inmate of a State institution was to be made returnable solely in the county where the institution was located. (See, e.g., Matter of Holbrook v. Holbrook, 31 Misc 2d 288; People ex rel. Ursoy v. Superintendent, 120 Misc. 353.)
Subdivision (e) of CPLR 7004, which has superseded the Civil Practice Act section on the subject, continues the differentiation between writs directed to State institutions and writs issued in other cases. The problem here presented arises only because of certain verbal changes made in the course of the consolidation and rephrasing of the applicable provisions. Thus, in place of the former language that “ All writs of habeas corpus ” directed to a State institution were to be made returnable in the county *334of the relator’s detention, the CPLR section recites that ‘ ‘ A writ to secure the discharge of a person from a state institution ” must he made so returnable and that “ In all other eases ” the writ is to be returnable in the county where it was issued unless the issuing court or judge decides to make it returnable in the county of detention. (Emphasis supplied.)2
Interpreting these terms in a strictly literal sense, a majority of the Appellate Division held that, since the relator was not seeking to be “ discharged ”, but only to be “ resentenced ”, the provision limiting the place of return of the writ to the county of detention was inapplicable and the place of return of the writ was, instead, left to the sound discretion of the issuing judge.
We cannot accept that interpretation. As the explanatory notes of the draftsmen of the CPLR make clear, the paraphrasing of the language in the Civil Practice Act was not intended to alter the rule that habeas corpus hearings must be held in the county of detention when the relator is an inmate of a State institution. The notes expressly state that “ The only change in substance ” was to provide, in cases where no judge was available in the county of detention, for the writ “ to be returned to the ‘ nearest accessible ’ judge, rather than [as formerly] to the ‘ nearest accessible * * * judge in an adjoining county.’ ” (See N. Y. Legis. Doc., 1959, No. 17, p. 66; see, also, 7 Weinstein-Korn-Miller, N. Y. Civ. Prac., par. 7004.07, p. 70-38.) Obviously, then, the phrase, “ A writ to secure the discharge of a person from a state institution ”, was adopted merely as a generic description of habeas corpus in terms of its function.
The Legislature has sought to relieve wardens of State prisons from having to comply with writs of habeas corpus by producing inmates out of the county of detention, under guard, and often *335at great distances and great expense. (See Ahrens v. Clark, 335 U. S. 188, 191.) The burden is equally heavy whether the relief sought by the writ be that of a permanent “ discharge ” or simply a remand for resentencing. Manifestly, to differentiate between the two situations would not only be completely illogical and unrealistic but would, indeed, serve to thwart the very policy considerations underlying the statute. Absent clear language to that effect, and considering the Contrary indications to be found in the Revisors’ Notes, we will not ascribe such ambivalent intentions to the Legislature. “ In construing statutory provisions, the spirit and purpose of the statute and the objectives sought to be accomplished by the legislature must be borne in mind. ‘ * * . * Literal meanings of words are not to be adhered to or suffered to “ defeat the general purpose and manifest policy intended to be promoted ” (See Matter of New York Post Corp. v. Leibowitz, 2 N Y 2d 677, 685; Matter of Capone v. Weaver, 6 N Y 2d 307, 309; People v. Ryan, 274 N. Y. 149, 152.)
Accordingly, we hold that CPLR 7004(c), like its predecessor in the Civil Practice Act, distinguishes between writs of habeas corpus concerning the inmates of State institutions, in the first instance, and writs “ In all other cases ”, in the second. Where the writ is directed to the warden of a State prison, whether it seeks a complete release from cusody or a remand for resentenc-ing, it must be made returnable in the county of detention, subject to the exception applicable when there is no available judge in that county. In all other cases, the writ is to be made returnable in the county of issuance, unless the issuing judge should decide in his discretion to make it returnable in the county of detention.
One question remains for our consideration — whether prohibition lies under the circumstances here presented. The majority of the Appellate Division, having concluded that the place for return of the writ was committed to the discretion of the issuing judge, held that prohibition was not available. However, under our interpretation of the statute, the respondent was completely without jurisdiction to hold any hearing on the writ in New York County, and it necessarily follows that the district attorney was fully warranted in seeking to prohibit such *336a hearing. We have uniformly held that prohibition is the proper remedy whenever a conrt threatens to act without or in excess of its power, not only with respect to a lack of jurisdiction over the subject matter (see, e.g., Matter of Kraemer v. County Ct., 6 N Y 2d 363; Matter of Hogan v. Court of Gen. Sessions, 296 N. Y. 1, 8-9; Matter of Morhous v. New York Supreme Ct., 293 N. Y. 131, 140; Matter of Culver Contr. Corp. v. Humphrey, 268 N. Y. 26, 39-40) but also where the Legislature has confined the exercise of jurisdiction to a court in some other county. (See Matter of Murtagh v. Leibowitz, 303 N. Y. 311, 319; Matter of Murphy v. Supreme Ct., 294 N. Y. 440, 445; see, also, Matter of Schneider v. Aulisi, 307 N. Y. 376, 381.)
Here, in point of fact, prohibition was the only adequate remedy available to prevent the threatened exercise of unauthorized power. No appeal was possible from the issuing judge’s direction for return of the writ in New York County or his refusal to make it returnable in Dutchess County, the place of detention; and an appeal from any order made at the completion of the habeas corpus hearing would be brutum fulmen — a complete futility — since, once the prisoner were produced in New York County and a hearing held, the act in excess of jurisdiction would be consummated, thereby defeating the jurisdictional imperatives of the statute. In such circumstances where the lack of jurisdiction is clearly established, the petitioner is entitled to relief in the nature of prohibition as a matter of law. (See, e.g., Matter of Baltimore Mail S. S. Co. v. Fawcett, 269 N. Y. 379, 383-385.)
The order of the Appellate Division should be reversed and the application for a judgment in the nature of prohibition granted, as prayed for in the petition.
Chief Judge DesmoND and Judges Yaw Voorhis, Burke, Soileppi, BergaN and KeatiNg concur.Order of Appellate Division reversed and matter remitted to that court with instructions to grant the order of prohibition as prayed for in the petition.
. The petition further alleged that the relator was not represented by his attorney at the time, but that claim would not be redressible by habeas corpus. The exclusive remedy for a deprivation of the right to counsel is coram nobis. (See, e.g., People ex rel. Sedlak v. Foster, 299 N. Y. 291; People ex rel. Cunningham v. McNeill, 306 N. Y. 645.)
. The full text of subdivision (e) of CPLR 7004 is as follows: “A writ to secure the discharge of a person from a state institution shall be made returnable before a justice of the supreme court or a county judge being or residing within the county in which the person is detained; if there is no such judge it shall be made returnable before the nearest accessible supreme court justice or county judge. In all other eases, the writ shall be made returnable in the county where it was issued, except that where the petition was made to the supreme court or to a supreme court justice outside the county in which the person is detained, such court or justice may make the writ returnable before any judge authorized to issue it in the county of detention.”