Justice Powell
delivered the opinion of the Court.
The question presented is whether a United States district court may compel the United States Marshals Service to transport state prisoners to the federal courthouse to testify in an action brought under 42 U. S. C. § 1983 by a state prisoner against county officials.
I — <
In June 1980, Richard Garland brought suit under 42 U. S. C. § 1983 against various Philadelphia County officials in the United States District Court for the Eastern District of Pennsylvania, alleging that he had been beaten and harassed by the defendant deputy sheriffs and prison guards. At the time Garland filed this suit, he was incarcerated in the Philadelphia County jail, but was subsequently transferred to a state facility. The District Court assigned the action to a Magistrate for disposition on the merits.
In December 1982, the Magistrate issued writs of habeas corpus ad testificandum to produce five witnesses, including plaintiff Garland. At that time, Garland was in a state correctional facility in Huntingdon, approximately 220 miles from Philadelphia. The other four witnesses were all confined in state facilities over 100 miles from Philadelphia. The orders directed the Wardens of the state facilities to transport inmates from state prison to the county jail nearest the federal courthouse in Philadelphia. The orders then commanded the United States Marshals Service (Marshals) to transport the inmates from that county facility to the federal court and to maintain custody of them during trial. The Marshals unsuccessfully moved for reconsideration of that portion of the order that directed them to transport the state prisoners from the county jail to the federal courthouse and to guard them during trial.
On the Marshals’ appeal from this denial, the Court of Appeals for the Third Circuit reversed in part, holding that the All Writs Act did not confer power upon the District Court “to compel non-custodians to bear the expense of [the production of witnesses] simply because they have access to a deeper pocket.” Garland v. Sullivan, 737 F. 2d 1283, 1287 (1984) (emphasis in original). The Court of Appeals did find, however, that the District Court has the power to compel the Marshals to take custody of state prisoners while those prisoners are in the federal courthouse in connection with federal judicial proceedings. Ibid. Finally, the court held that the District Court could order the Marshals to take custody of state prisoners if the trial court made a specific finding that special security risks required that state prisoner-witnesses be in the Marshals’ custody away from the federal courthouse. Id., at 1289.
The Commonwealth Bureau of Correction (Commonwealth) petitioned this Court for a writ of certiorari on the question whether a federal court can command the Marshals to share responsibility with state officials for transporting state inmates to the federal courthouse when neither the State nor any state official is a party. Because this case presents a recurrent problem on which the Circuits differ, we granted the writ. 469 U. S. 1206 (1985). We find that there is no statutory authority for a United States district court to command the Marshals to take custody of state prisoners outside the federal courthouse during the normal course of producing state prisoner-witnesses for trial, and accordingly affirm.
II
The Commonwealth argues that the Marshals have a statutory obligation to obey the lawful orders and writs of the federal courts, 28 U. S. C. § 569(b), and are statutorily authorized to expend funds for the specific purpose of transporting prisoners, § 567. It also contends that these provisions recognize the authority of the district courts to seek assistance from the Marshals. Two Circuits have summarily agreed. Ford v. Allen, 728 F. 2d 1369, 1370 (CA11 1984) (per curiam); Ballard v. Spradley, 557 F. 2d 476, 481 (CA5 1977). Two other Circuits have relied in part on these provisions in imposing the responsibility for transport upon the Marshals. Wiggins v. County of Alameda, 717 F. 2d 466 (CA9 1983), cert. denied sub nom. California Dept. of Corrections v. United States, 465 U. S. 1070 (1984); Ford v. Carballo, 577 F. 2d 404 (CA7 1978). The Court of Appeals for the Third Circuit is the only Circuit to deny a district court authority to compel the Marshals to assist in transporting state prisoner-witnesses to the federal courthouse.
Sections 569(b) and 567 merely enumerate obligations of the Marshals. The Marshals must obey the mandates of federal courts and transport prisoners if the court so orders. The courts’ authority to issue such writs, however, must derive from some independent statutory source. We therefore must look to the habeas corpus statute or the All Writs Act to see if they authorize federal courts to order the transportation of state prisoners to the federal courthouse.
r-4 HH » — I
The Court of Appeals reasoned that the Magistrate’s order amounted to a writ of habeas corpus ad testificandum properly directed only to the custodian, and that there was no basis in the habeas corpus statute for the District Court’s authority to direct a writ ad testificandum to a noncustodian. We agree.
Since 1867, the writ of habeas corpus has incorporated the common-law command that the writ “shall be directed to the person in whose custody the party is detained.” Act of Feb. 5, 1867, ch. 28, 14 Stat. 386 (emphasis added). See In re Thaw, 166 F. 71, 74-75 (CA3 1908). It was the custodian who then was to “make return of said writ and bring the party before the judge who granted the writ.” Ibid. Congress preserved this unambiguous directive throughout subsequent revisions, and the current habeas corpus statute states that the writ “shall be directed to the person having custody of the person detained.” 28 U. S. C. §2243. Section 2243 also specifically provides that “the person to whom the writ is directed shall be required to produce at the hearing the body of the person detained.”
The language of the statute thus expressly commands the custodian to bring his prisoner to the court, but extends this duty to no other. See also Fed. Rule Civ. Proc. 81(a)(2) (“The writ of habeas corpus . . . shall be directed to the person having custody of the person detained”). We find no evidence in the language of §§ 2241 and 2243, in their legislative history, or in the common-law writ ad testificandum to suggest that courts are also empowered to cause third parties who are neither custodians nor parties to the litigation to bear the cost of producing the prisoner in a federal court. We therefore conclude that there is no basis in the habeas corpus statute for a federal court to order the Marshals to transport state prisoners to the federal courthouse.
> hH
Finally, the Commonwealth argues that the All Writs Act, 28 U. S. C. § 1651, confers authority upon a district court to order the Marshals to transport state prisoners to and from the federal courthouse in connection with federal litigation. It argues that the “deluge of. . . civil rights actions” calls for “creative” use of federal judicial power to alleviate the drain on the States’ fiscs from the transport of inmates to and from federal courthouses.
It is true that this Court consistently has construed the All Writs Act to authorize a federal court “to issue such commands ... as may be necessary or appropriate to effectuate and prevent the frustration of orders it has previously issued in its exercise of jurisdiction otherwise obtained.” United States v. New York Telephone Co., 434 U. S. 159, 172 (1977). This Court also has held that the supplemental powers of the Act are not limited to situations where it is “necessary” to issue the writ or order “in the sense that the court could not otherwise physically discharge its appellate duties.” Adams v. United States ex rel. McCann, 317 U. S. 269, 273 (1942). An examination of the language of the All Writs Act, its legislative history, and our decisions construing it convinces us, however, that the Act does not authorize a district court to order the Marshals to transport state prisoners from state prisons to the federal courthouse in the ordinary course of litigation in federal courts.
The All Writs Act originally was codified in § 14 of the Judiciary Act of 1789, 1 Stat. 81-82, which provided that
“all the . . . courts of the United States, shall have power to issue writs of scire facias, habeas corpus, and all other writs not specifically provided for by statute, which may be necessary for the exercise of their respective jurisdictions, and agreeable to the principles and usages of law.”
Our early view of the scope of the all writs provision confined it to filling the interstices of federal judicial power when those gaps threatened to thwart the otherwise proper exercise of federal courts’ jurisdiction. McClung v. Silliman, 6 Wheat. 598 (1821); McIntire v. Wood, 7 Cranch 504 (1813). This limitation is especially significant in construing federal courts’ power to issue writs of habeas corpus ad testifican-dum: The Judiciary Act of 1789 codified the ad testificandum writ in the same section as the all writs provision.
The original phrase “not specifically provided for by statute” remained in the all writs section until 1948. Although the legislative history is scant, it appears that Congress then merely consolidated various provisions into § 1651 and made “necessary changes in phraseology” without substantive amendment. See H. R. Rep. No. 308, 80th Cong., 1st Sess., A144 (1947); see also id., at 5. The legislative history did, however, state that the new section was “expressive of the construction recently placed upon [the all writs provision] by the Supreme Court in U. S. Alkali Export Assn. [v. United States, 325 U. S. 196 (1945)].” Id., at A145. In United States Alkali, the Court rejected use of the all writs provision to enable the Court to review a lower court’s determination where jurisdiction did not lie under an express statutory provision. Chief Justice Stone wrote:
“The writs may not be used as a substitute for an authorized appeal; and where, as here, the statutory scheme permits appellate review of interlocutory orders only on appeal from the final judgment, review by certiorari or other extraordinary writ is not permissible in the face of the plain indication of the legislative purpose to avoid piecemeal reviews.” 325 U. S., at 203.
Although Congress dropped the phrase “not specifically provided for by statute” in its 1948 consolidation, we conclude that it apparently intended to leave the all writs provision substantially unchanged. That intention and the favorable reference to United States Alkali convince us that the 1948 changes in phraseology do not mark a congressional expansion of the powers of federal courts to authorize issuance of any “appropriate” writ.
Nevertheless, the Commonwealth, relying on United States v. New York Telephone Co., supra, at 171, as well as Harris v. Nelson, 394 U. S. 286, 299 (1969), and Price v. Johnston, 334 U. S. 266, 282 (1948), insists that under the All Writs Act the District Court can order the Marshals to transport state prisoners upon a mere statement that such an order would be “necessary or appropriate.” As summarized in the margin below, these cases are clearly distinguishable and lend little support to the Commonwealth’s argument.
The All Writs Act is a residual source of authority to issue writs that are not otherwise covered by statute. Where a statute specifically addresses the particular issue at hand, it is that authority, and not the All Writs Act, that is controlling. Although that Act empowers federal courts to fashion extraordinary remedies when the need arises, it does not authorize them to issue ad hoc writs whenever compliance with statutory procedures appears inconvenient or less appropriate. We need not categorically rule out reliance on the All Writs Act and the use of Marshals in procuring or safeguarding state prisoner-witnesses in the course of federal litigation. There may be exceptional circumstances in which a district court can show clearly the inadequacy of traditional habeas corpus writs, such as where there are serious security risks. In such circumstances, a district court may find it “necessary or appropriate” for Marshals to transport state prisoners. We therefore leave open the question of the availability of the All Writs Act to authorize such an order where exceptional circumstances require it.
V
We conclude, at least in the absence of an express finding of exceptional circumstances, that neither a magistrate nor a district court has authority to order the Marshals to transport state prisoners to the federal courthouse to testify in an action brought by a state prisoner under 42 U. S. C. § 1983 against county officials. Accordingly, we affirm the Court of Appeals for the Third Circuit.
It is so ordered.
The Marshals are within the Executive Branch of the Federal Government. The Marshal for each district is appointed by the President, 28 U. S. C. § 561(a), is subject to the supervision and direction of the Attorney General, see, e. g., §§562, 567, 569(c), 571(a) and (d), and is funded through Department of Justice appropriations, e. g., §567.
Judge Becker concurred in the judgment, believing the court to be bound by McClung v. Silliman, 6 Wheat. 598 (1821), and McIntire v. Wood, 7 Cranch 504 (1813). He hoped that this Court would “find that, because statutes can adapt to fit the needs of changing times, the All Writs Act now permits what, in the time of Mclntire and McClung it did not.” 737 F. 2d, at 1292 (footnote omitted). Judge Atkins, sitting by designation from the Southern District of Florida, concurred in part and dissented in part, believing that the Third Circuit could impose a duty on the Marshals to transport state prisoners. Ibid.
The propriety of that part of the order commanding the Marshals to take custody of the state prisoners while they are in the federal courthouse is not specifically before us. The Marshals have conceded that they are responsible for the custody of state prisoners in the federal courthouse as witnesses or parties.
The habeas corpus statute provides in pertinent part that the writ “shall be directed to the person having custody of the person detained,” and that “the person to whom the writ is directed shall be required to produce at the hearing the body of the person detained.” 28 U. S. C. §2243.
Carbo v. United States, 364 U. S. 611 (1961), does not support an expansive reading of the power conferred upon federal district courts by the writ of habeas corpus ad testificandum. In Carbo, the Court found that although § 2241 contained an express territorial limitation of “[w]rits of habeas corpus,” 28 U. S. C. § 2241(a), the limitation applied to habeas corpus ad subjiciendum, but not to habeas corpus ad prosequendum. The Commonwealth similarly argues that the provisions in § 2243 that direct the custodian to produce the prisoners in court do not apply to the writ ad testificandum but instead are limited to the Great Writ, habeas corpus ad subjiciendum.
Carbo’s expansive reading of the statute was consistent with common-law procedure and requirements applied to the writ ad prosequendum and with the legislative history of § 2241(a). 364 U. S., at 615-618. But this ease involves the writ ad testificandum, which has been confined in its application to the actual custodian of the prisoners from before its initial codification in 1789 to the present. We therefore do not believe that Carbo justifies a more expansive view of the writ of habeas corpus ad testificandum today.
The All Writs Act provides in pertinent part:
“The Supreme Court and all courts established by Act of Congress may issue all writs necessary or appropriate in aid of their respective jurisdictions and agreeable to the usages and principles of law.”
In United States v. New York Telephone Co., 484 U. S. 159 (1977), the Court held that a District Court could under the All Writs Act compel a third party, the New York Telephone Company, to assist the Federal Bureau of Investigation in installing devices under a warrant that would register the numbers dialed on certain telephones. In that case the All Writs Act filled a gap in federal statutes by granting the District Court jurisdiction over the only party capable of installing the devices. In the instant case, by contrast, the habeas corpus statute already expressly provides for the issuance of a writ “to the person having custody of the person detained.”
In Price v. Johnston, 334 U. S. 266 (1948), the Court held that a Court of Appeals could order a prisoner to be brought before it to argue his own appeal, finding that the All Writs Act was a mechanism to achieve the “rational ends of law. ” Id., at 282. In Price, however, there was no alternative way to bring the prisoner before the court. In the present ease, the traditional writ ad testificandum is sufficient. Similarly, Harris v. Nelson, 394 U. S. 286 (1969), held that the District Court in that case had no alternative means of providing an effective habeas corpus proceeding except by use of an extraordinary writ. New York Telephone, Price, and Harris afforded resort to the All Writs Act to fill statutory interstices. We do not find their reasoning controlling here, where a writ ad testifican- dum directed to the custodian indisputably provides a district court with a means of producing a prisoner-witness.