The United States, the State of Arizona, and Maricopa County appeal an order by the district court which transferred Nathan Warren, Sr. from state to federal custody and which credited his federal sentences with time spent in state custody. Because the district court exceeded its jurisdiction under Fed.R.Crim.P. 35 in granting relief, we reverse the orders with respect to the terms contested by appellants.
In September 1975, Warren was convicted in federal district court on charges of extortion. He was subsequently sentenced to 12 years’ imprisonment on each of two counts and was allowed to remain free pending appeal. In April 1977, while Warren’s appeal was pending before the Ninth Circuit, Arizona officers arrested him on state bribery charges.
Following interviews with county, state, and federal prosecutors concerning his possible cooperation in organized crime investigations, Warren pleaded guilty to state charges of bribery, land fraud, and conspiracy. At the time of Warren’s guilty pleas, he was recovering from open-heart surgery and was concerned about the quality of medical care in state facilities. Local prosecutors assured Warren, he says, that if he cooperated with the United States Attorney’s investigation of organized crime activities in Arizona to the satisfaction of federal and local prosecutors, the state would recommend that his state sentences be served in a federal institution. At the same time, the United States Attorney’s office promised Warren that if he cooperated in its investigation, the Government would not oppose a Rule 35 motion for reduction of his 1975 federal sentence and would not prosecute him on additional federal charges.
The relationship between Warren’s guilty pleas to the state charges and the agreements describing consideration for his cooperation with federal investigators is unclear. Warren contends that the three transactions — his guilty pleas, the agreement with the Maricopa County district attorney concerning cooperation with the federal investigation, and the agreement with the United States Attorney’s office — are all elements of one “plea bargain” package. *683Warren asserts that without assurances by local and federal prosecutors concerning consideration for his cooperation he would not have entered the state-court guilty pleas. Conversely, the government agencies argue that Warren’s guilty pleas were independent of any agreements concerning his possible cooperation. They deny that a “plea bargain” package was agreed upon. We need not resolve that debate now.1
On June 9, 1977, after questioning Warren for five hours, federal and state prosecutors broke off their interviews, claiming that Warren had breached his agreement to cooperate.
In September 1977, Warren filed a civil action in state courts, seeking to withdraw his guilty pleas on the ground that the prosecutors had violated the “plea agreement”. After federal officers, named as defendants, were dismissed as parties, the state court ruled against Warren, finding that he, and not the prosecutors, had breached whatever agreement there was. That decision was pending in the Arizona courts at the time of oral argument.2
In September 1977, Warren was indicted on federal mail fraud charges. While these charges were pending, on January 23, 1978, a state court sentenced Warren to six consecutive 9-10 year prison terms for his 1977 state convictions. The state court immediately ordered Warren incarcerated in the state prison at Florence. Shortly thereafter, in federal court, Warren entered a guilty plea to one count of the mail fraud indictment, pursuant to a plea arrangement. The Government agreed to move the dismissal of the remaining counts and to recommend that any sentence Warren received be served concurrently with his state sentences. The Honorable Walter Craig3 sentenced Warren to a term of five years, to be served concurrently with his 1975 federal sentence for extortion, and placed Warren in the custody of the United States Marshal. The Honorable Ronald Davies4 subsequently directed the marshal to return Warren to the state prison at Florence.5
While in state custody, on June 5, 1978, Warren filed a combined motion in federal court under Fed.R.Crim.P. 35, entitled “Motion to Reduce Sentence, Motion to Transfer to Federal Custody, Motion to Establish Date of Incarceration”. Judge Craig held hearings on this motion, and Warren, who was ordered to appear before the district court pursuant to a writ of habeas corpus ad testificandum, was surrendered to the marshal by state officers.
On February 1, 1979, Judge Craig found that state and federal prosecutors had breached the 1977 “plea bargain” with Warren and granted Warren’s requested relief in a four-part order. The order, pursuant to Rule 35, reduced Warren’s 1975 sentence from 12 to 9 years; reduced the 1978 federal sentence from 5 to 3 years, to be served concurrently with the 1975 sentence; ordered that Warren be transferred to federal custody; and ordered that Warren’s federal sentences be credited with time spent in state custody. The several appellants challenge the transfer to federal custody and the attempt to assign credit for time served.
We first address the contention that the district court exceeded its authority under Rule 35 in ordering Warren transferred from state to federal custody. While *684a district court has almost unlimited discretion under Rule 35 to reduce federal sentences upon a timely motion 6, its authority to “correct an illegal sentence” or to “correct a sentence imposed in an illegal manner” does not include a general authority to transfer an inmate from state to federal custody. Other remedies must be sought for the purpose of enforcing a plea arrangement in a state prosecution. A sentence inconsistent with a plea agreement cannot be characterized as “illegal”, as that term has been applied under Rule 35. See Hill v. United States, 368 U.S. 424, 430, 82 S.Ct. 468, 7 L.Ed.2d 417 (1962); United States v. Stevens, 548 F.2d 1360 (9th Cir.), cert. denied, 430 U.S. 975, 97 S.Ct. 1666, 52 L.Ed.2d 369 (1977). Moreover, even assuming that a Rule 35 motion can be employed to attack a federal sentence as inconsistent with a plea bargain, a proposition supported by none of the authorities on which Warren relies7, Rule 35 is available as a remedy only to reach federal sentences. Here, Warren attempted to employ Rule 35 to challenge his incarceration in state prison on a state conviction. This he may not do.
Warren argues that the district court could have construed his motion as a petition for a writ of habeas corpus and ordered his transfer as a part of habeas relief. This analysis is flawed because he had not exhausted his state remedies, as required by the relevant habeas corpus provision, 28 U.S.C. § 2254(b), (c). The civil action in which Warren sought to withdraw his guilty plea in the Arizona court, Warren v. Hill, was still pending in the Arizona appellate system. After Warren’s litigation in the Arizona courts becomes final, he can file a proper habeas corpus petition in the federal system.
We conclude that the district court was without jurisdiction to make findings concerning the nature and possible violation of the 1975 “plea agreement” and the quality of medical treatment in Arizona state prisons. Accordingly, these findings have no binding effect on any litigation in which Warren may be a party. In so holding, we imply nothing about the abstract validity of the district court’s conclusions.
Warren also argues that, regardless of the district court’s authority under Rule 35 or 28 U.S.C. § 2254, the court had jurisdiction to transfer him to federal custody to serve his federal sentences, because it had personal jurisdiction over him pursuant to his appearance in the Rule 35 hearing under a writ of habeas corpus ad testificandum. Assuming for present purposes that the district court had personal jurisdiction over Warren,8 the attempt to transfer Warren from state to federal custody violated fundamental principles of comity and separation of powers.
Determination of priority of custody and service of sentence between state and federal sovereigns is a matter of comity to be resolved by the executive branches of the two sovereigns. Normally, the sovereign which first arrests an individual acquires priority of jurisdiction for pur*685poses of trial, sentencing, and incarceration. However, the sovereign with priority of jurisdiction, here, the United States, may elect under the doctrine of comity to relinquish it to another sovereign. This discretionary election is an executive, and not a judicial, function. See Ponzi v. Fessenden, 258 U.S. 254, 261-62, 42 S.Ct. 309, 66 L.Ed. 607 (1922); Strand v. Schmittroth, 251 F.2d 590, 609 (9th Cir.), cert. dismissed, 355 U.S. 886, 78 S.Ct. 258, 2 L.Ed.2d 186 (1957).
In the federal system, the “power and discretion” to practice comity is vested in the Attorney General. Ponzi v. Fessenden, 258 U.S. at 262, 42 S.Ct. 309. And, in this case, the officer designated by the Attorney General had decided, as a matter of comity, to return Warren to state custody after the Rule 35 hearing. The district court, by remanding Warren to federal custody, was, in effect, overriding the Attorney General’s exercise of discretion in a case in which the appropriate officer was not a party, and his discretion was not before the court for review. If an Attorney General abuses his discretion in practicing comity, the proper remedy would be by writ of habeas corpus, a writ of mandamus, or by an action under 42 U.S.C. § 1983, not by a district court’s unilateral action on a Rule 35 motion.
The United States also contends that the district court exceeded its jurisdiction in crediting Warren’s federal sentences with time spent in state custody. The district court had great discretion under Rule 35 in reducing Warren’s sentences. The court might have reduced his sentences by the same amount of time which was credited to them. But an order simply crediting time spent in state custody is the functional equivalent of an order imposing a federal sentence to run concurrently with a state sentence: it specifies where a prisoner will serve some or all of a federal sentence. Such an order conflicts with the Attorney General’s authority under 18 U.S.C. § 4082(a) and (b) to designate the place of confinement for federal prisoners and is invalid.9 See United States v. Clayton, 588 F.2d 1288, 1292 (9th Cir. 1979); United States v. Huss, 520 F.2d 598, 602 (2d Cir. 1975).
The district court’s orders are affirmed with respect to the reduction of federal sentences. They are reversed to the extent that they purport to deal with transfer or designation of place of confinement and the crediting to the federal sentence of the time spent in state custody.
Affirmed in part and reversed in part.
. The district court adopted Warren’s “tripartite” characterization of the “plea bargain". For reasons developed below, infra note 8, the district court had no jurisdiction in the Rule 35 proceeding to make findings concerning the nature of Warren’s arrangements with the • prosecutors.
. Warren v. Hill, No. C-348574. The Arizona Court of Appeals affirmed the trial court on December 20, 1979.
. Senior United States District Judge, District of Arizona, then Chief Judge.
. United States District Judge, District of North Dakota, sitting in Arizona by designation.
. Warren was sentenced by Judge Craig on February 8, 1978. On February 10, Warren appeared before Judge Davies in Warren v. Cardwell, CIV. 78-85-PHX-WPC, a habeas corpus action filed on February 1, alleging that Warren’s life was endangered by other inmates at Florence. Judge Davies dismissed the petition for habeas corpus and directed that Warren be returned to state custody.
. The government does not contest the reduction of sentences on Warren’s 1975 and 1977 federal convictions.
. See, e. g., Palermo v. Warden, 545 F.2d 286 (2d Cir. 1976), cert. dismissed, 431 U.S. 911, 97 S.Ct. 2166, 53 L.Ed.2d 221 (1977) (habeas corpus); Correale v. United States, 479 F.2d 944 (1st Cir. 1973) (habeas corpus); United States v. Ewing, 480 F.2d 1141 (5th Cir. 1973) (appeal); Lebosky v. Saxbe, 508 F.2d 1047 (5th Cir. 1975) (mandamus).
. The parties dispute the meaning of a recent Second Circuit decision, In re Liberatore, 574 F.2d 78 (1978), which holds that appearance under a writ of habeas corpus ad testificandum gives a court only temporary jurisdiction over the person. In this circuit, however, a court has exclusive personal jurisdiction over any party who appears before it, regardless of how that appearance was effected. See United States v. Zammiello, 432 F.2d 72, 73 (9th Cir. 1970); Strand v. Schmittroth, 251 F.2d 590, 594-95 (9th Cir.), cert. dismissed, 355 U.S. 886, 78 S.Ct. 258, 2 L.Ed.2d 186 (1957); Stamphill v. Johnston, 136 F.2d 291, 292-93 (9th Cir.), cert. denied, 320 U.S. 766, 64 S.Ct. 70, 88 L.Ed. 457 (1943). Whether the Liberatore qualification of this general rule should be adopted — and appellant Arizona advances persuasive policy reasons for its adoption — is a question which need not be considered here. Cf. United States v. Perno, 605 F.2d 432, 433 (9th Cir. 1979).
. The district court’s order is also invalid because, by crediting time spent in state custody, it effectively began Warren’s sentence before he was delivered to federal authorities. This violates 18 U.S.C. § 3568 (1976). See United States v. Perno, 605 F.2d 432, 433 (9th Cir. 1979).