After lodging a detainer against appellant with state prison authorities in Massachusetts, where he was incarcerated, the federal government, on March 24, 1974, used a writ of habeas corpus ad prosequen-dum to obtain appellant’s presence in the Southern District of New York for purposes of arraignment on charges arising out of a Middletown, New York, bank robbery.1 Despite his repeated requests for a prompt trial and despite the fact that Article IV(c) of the Interstate Agreement on Detainers Act (Detainers Act)2 requires trial within 120 days unless continuances are granted for good cause in open court, the imprisoned appellant was not tried until September 2, 1975, more than 17 months later. Because of the failure to comply with the speedy trial requirements of Article IV(c) and because Article V(c) of the Act mandates that in such event the indictment be dismissed with prejudice, we reluctantly reverse, with directions to dismiss the indictment.
Federal authorities arrested appellant in Chicago on October 11,1973, on two federal warrants — one for bank robbery issued by the Southern District of New York and one for unlawful flight issued by the District of Massachusetts. The unlawful flight charge was dismissed but appellant also faced various state charges filed against him in Massachusetts. He was therefore turned over to Chicago authorities for extradition to Massachusetts for trial on state charges, and the federal warrant issued by the Southern District for bank robbery was lodged with the Massachusetts authorities as a detainer. Appellant pleaded guilty to the Massachusetts charges and was sentenced to concurrent terms of 8 to 10 years.
On March 21, 1974, an indictment for bank robbery was filed in the Southern District of New York, and on March 24 a writ of habeas corpus ad prosequendum was used to obtain custody of appellant for arraignment. On April 1, the government filed its notice of readiness for trial as required by Rule 4 of the Plan for the Prompt Disposition of Criminal Cases of that district. Two days later, however, the government filed the present superseding indictment, naming in addition one James P. Flynn, who thereupon took flight. On April 15, appellant pleaded not guilty. Trial was set for May 28, 1974.
Shortly before trial was to commence, on May 17, the government requested the first of what was to become a long series of delays, moving to adjourn the trial for 90 days or until Flynn was apprehended, whichever came first, and supporting its motion by sealed affidavit. Over appellant’s vigorous protests, the motion was granted and trial was set for August 21. Following the granting of the adjournment, appellant requested to be returned to Massachusetts custody, so that he and his attorney could more conveniently prepare for trial and because his family was in Massachusetts. He was returned on June 14, 1974.
In August, after the original judge, Judge Bauman, resigned from the bench, the case was assigned to Judge Motley. Without explanation, the trial date was postponed to November 18. On November 1, the government again moved for an adjournment of 90 days within which to apprehend appellant’s co-defendant, again supporting its motion by sealed affidavit. On November 4 the defense moved to dismiss the indictment on the ground that appellant had been denied a speedy trial. The district court denied the speedy trial motion and granted the further adjournment, setting trial for February 18, 1975.
On the date set for trial, however, the trial judge was engaged in another trial. Despite the fact that we had recently em*736phasized that calendar congestion could not justify delay of a criminal trial and stated that under such circumstances the trial judge should sua sponte transfer the case to another judge for prompt trial,3 trial was postponed another four months, to June 11. The defense reiterated its speedy trial objections. In the following month the Southern District of New York undertook a crash program for civil cases, to begin June 1. When the government sought to ascertain whether appellant’s trial would be affected, Judge Motley, sua sponte, set a new trial date of September 2, 1975. Defense counsel was subsequently notified.
On August 8 the government obtained appellant from Massachusetts for trial by way of a second writ of habeas corpus ad prosequendum. At the beginning of trial appellant again moved for a dismissal of the indictment for failure to provide a speedy trial. This motion, like his first, was denied. Appellant was convicted on all counts and was sentenced to concurrent 5-year terms. Judge Motley recommended that the federal terms be allowed to run concurrently with the Massachusetts state terms appellant was already serving.
DISCUSSION
Because we uphold appellant’s claims under the Detainers Act, we need not discuss his other claims.4 Many of the questions treated by the government here as open were recently settled in this circuit by our decision in United States v. Mauro, 544 F.2d 588 (2d Cir. 1976) where we held that under the Detainers Act the United States is bound by the statute’s definition of it as both a sending and a receiving “State” and that the writ of habeas corpus ad prosequendum constitutes a “detainer” and a “request” by a prosecuting authority within the meaning of the Act, with the present author dissenting in that case from the majority’s holding that a writ of habeas corpus ad prosequendum constitutes a “de-tainer.” The government here, however, has conceded that appellant in this case was subject to a detainer, separate and apart from the writ, filed by it with the Massachusetts authorities.5 Whether the writ independently constitutes a detainer, therefore, is not at issue here.
Granting that appellant here was subject to a “detainer” and that he was obtained by the federal authorities through a “request” as that term is used in Article IV(a) of the Act, under Mauro it is clear that the Detainers Act applies. Strictly speaking, this case therefore presents only two questions under the Act: (1) whether the Act was violated and, (2) if so, whether such violation warrants reversal of the conviction below. Because the government argues strenuously that the writ of habeas corpus cannot constitute a “request” under Article IV of the Act, however, we will begin with a review of the reasons for our disagreement with the government’s position.
The government’s argument rests upon a proviso in Article IV(a) to the effect that, after receipt by appropriate state authorities of a request from another jurisdiction for custody of a prisoner, there shall be a 30-day waiting period during which the governor of the sending state may disapprove the request and thus in effect dishon- or it.6 If a habeas writ Were treated as a “request,” the argument goes, the effect *737would be a sub silentio partial repeal of 28 U.S.C. § 2241(c)(5), which authorizes a federal court to command a state custodian to turn over a prisoner to federal authority, presumably without delay or the right to disapprove.7 Since a partial repealer of that section should not lightly be inferred, see Rosencrans v. United States, 185 U.S. 257, 17 S.Ct. 302, 41 L.Ed. 708 (1897), the argument goes, the writ should not be held to constitute a “request,” and therefore the government here should be freed from the trial limitations of the Detainers Act.
Although the government’s argument might at first blush appear to have some theoretical appeal, the history and purpose of the Act indicates that the Article IV(a) proviso was aimed merely at preserving the existing law with respect to interstate transfers, under which the governor of the sending state might refuse to turn over a prisoner to another state, as distinguished from federal authorities. However, regardless of the reach of that proviso — and this issue is not before us, since the Governor of Massachusetts has never refused to honor the federal writ of habeas corpus commanding that Ford be produced — a review of the structure and purposes of the Detainers Act makes it abundantly clear that its speedy trial provisions were intended to apply to the federal government as a “State” under the Act.
The Detainers Act was originally drafted in response to a variety of problems arising out of the then unregulated system of de-tainers commonly used where one or more jurisdictions had charges outstanding against a prisoner held by another jurisdiction. Under that system, once one of the jurisdictions had tried and convicted him the other jurisdictions, instead of trying him on their charges, would simply file de-tainers with the prison authorities holding him. The detainers would serve to' notify the prison authorities that charges were pending against the prisoner elsewhere. Upon the prisoner’s completion of the first prison term, the second jurisdiction could bring the defendant to trial on its own charges and, should a conviction be obtained, still other jurisdictions desiring to press charges might then file detainers with the prison where he was next incarcerated.
The disadvantages and potential abuses of this system were many.8 Prison authorities often accorded detainers considerable weight in making decisions with respect to the terms and conditions of the prisoner’s incarceration and release on parole. Sometimes the prisoner would automatically be held under maximum security.9 Sometimes he would be ineligible for special work programs, athletic programs, release for visits to relatives’ death beds or funerals, or spe*738cial minimum security facilities.10 Often detainers precluded the granting of parole.11 Despite these serious consequences, virtually any law enforcement officer-prosecutor, policeman, or judge— could file a detainer without any procedural prerequisites.12 No pending indictment or other formal notification of charges was generally required. Indeed, it was estimated that as many as 50% of all detainers were allowed to lapse on the prisoner’s release, without any attempts at prosecution by the jurisdiction that had filed the detain-er.13 There were even cases in which the only reason the detainer had been filed was to increase the severity of the prisoner’s sentence.14 Thus detainers imposed major unjustifiable hardships on prisoners, and, *739prior to adoption of the Agreement on De-tainers, there was nothing a prisoner could do about them.
In addition, the pending charges forming the basis of a detainer might themselves significantly impede the development of a coherent program for the prisoner’s punishment and rehabilitation. Often the various charges would arise out of a single criminal episode or out of events occurring within a short period of time. Instead of permitting coordination of sentencing and rehabilitation, the old detainer system often inhibited fair sentencing and effective rehabilitation. The first judge, in sentencing a defendant against whom a detainer had been lodged, would have to decide whether to disregard the other pending alleged offenses or lengthen the sentence to take those offenses into account. The other offenses, if proven, would clearly be relevant in determining whether the offense which was to be the subject of the first sentence was an isolated incident and what length of custody might be necessary for the defendant’s rehabilitation. On the other hand, if the judge meted out a long sentence, taking the other offenses into account, there was nothing to prevent other jurisdictions, after they had tried and convicted the defendant on the pending charges, from punishing the defendant further for those offenses.15 Since, by the nature of the detainer system, the sentences would be served consecutively, the prisoner would then serve a total sentence longer than that intended by the first sentencing judge.16 Similarly, parole boards and prison authorities found it difficult to formulate the prisoner’s rehabilitative program, since they were forced to act without knowing whether the prisoner would be convicted on the other pending charges.17
This same uncertainty also often adversely affected the prisoner’s attitude towards his own rehabilitation. No matter how well he might behave and how zealously he might work towards his own rehabilitation, there was no way, as long as a detainer had been lodged and was pending against him, whereby he could count on release within a given period.18 The system also tended to *740eliminate the possibility of concurrent sentencing, even when the charges in the various jurisdictions all stemmed out of the same criminal episode or occurred within a short period of time.19
Moreover, the prisoner subject to a de-tainer was handicapped by delay in preparing for trial of the charge upon which it was based. As in all cases of trial delay, witnesses might die, evidence disappear, and memories fade. While the state could gather its evidence and preserve it for an eventual trial, the prisoner, confined in another jurisdiction, was often unable to do so, particularly if he could not afford to retain counsel.20 Indeed, sometimes he would not even be informed that charges were pending against him.21
Finally, even when all jurisdictions concerned were otherwise willing to permit a temporary transfer to accord the prisoner a prompt trial on pending charges, such transfers were hampered by a lack of a uniform set of rules as to the mechanics of such transfers. Arrangements would have to be made for payment of the cost of transfers, prisoner upkeep, pursuit and recovery in the event of escape and prompt return.22 There was no guarantee to the sending state that the receiving state would try and return the prisoner promptly — or return him at all. Indeed, at least one state refused to participate in such transfers because of a tendency on the part of receiving jurisdictions not to return the borrowed prisoners.23
It was to remedy these problems that the present Interstate Agreement on Detainers was adopted in 1970 on behalf of the United States and the District of Columbia by way of the Interstate Agreement on Detainers Act.24 The Agreement adopted by the Act *741provided the prisoner with a method of clearing detainers and charges outstanding against him and provided prosecutors with a uniform set of rules governing temporary transfers for purposes of trial. Under the Agreement, prison authorities must notify a prisoner immediately of any detainers lodged against him and must inform him of his rights under the Agreement. Article III then affords him the right to demand trial on the charges underlying the detain-er. In response to such a demand, the prison authorities must offer custody of the prisoner to the authorities that have lodged the detainer. Art. V(a). If the latter refuse to accept custody, the indictment on which the detainer is based must be dismissed with prejudice. Art. V(c). If instead they accept custody, they must try the prisoner within 180 days, unless a continuance is granted in open court. Art. 111(a).
Article IV governs requests initiated by the prosecutor. In part, Articles IV and V alleviated the problems that previously had plagued interjurisdictional transfers for purposes of trial. Trial must be commenced within 120 days (plus continuances for good cause granted in open court) and the prisoner returned as expeditiously as possible. Arts. IV(c) and V(e). Article V also governs the handling of expenses and escape. In part the limitations imposed by Article IV constitute necessary corollaries to those imposed by Article III, since without the Article IV limitations prosecutors would be able to avoid the limitations under Article III merely by arraigning the prisoner without any intention of granting a prompt trial, thereby circumventing the requirements of the Agreement.
Our interpretation of the Detainers Act should reflect Congress’ purpose, as revealed in the foregoing history, which was to provide a comprehensive and coherent solution to a multiplicity of problems that had prior to the adoption of the Act beset prisoners, prosecutors, judges, prison authorities, and parole boards alike under the old detainer system. Under the Act a prisoner can force the expeditious disposition of outstanding detainers and their underlying charges. Similarly prosecutors can more easily obtain prisoners for trial; judges and prison and parole authorities can more rationally administer punishment and rehabilitation. Whether or not the Act should apply to a case where the sole federal intervention is the issuance of a habeas writ, see, e.g., United States v. Mauro, 544 F.2d 588 (2d Cir.1976), the speedy trial provisions must surely apply to a state prisoner like Ford, against whom a federal detainer was lodged for years. To hold that the proviso to Article IV(a) precludes application of those provisions in such a case would be to stand the Act on its head.
The Article IV(a) proviso plays a very minor role in the Act’s general structure. One of the problems involved in formulating a workable transfer procedure among states was to preserve states’ rights to refuse extradition, and it is this right that the Article IV(a) proviso embodies.25 While there is some dispute as to the extent of a state’s right to refuse to comply with a federal writ of habeas corpus ad prosequendum,26 there is no evidence that the Article IV(a) proviso and its adoption by Congress were intended to augment or diminish that right in any way; it rather appears that *742they were merely intended to preserve prior law with respect to interstate transfers.
Thus we are asked to take a hypothetical and possibly non-existent conflict between a minor provision of the Act which relates to transfer mechanics (the Art. IV(a) proviso) and prior federal law (28 U.S.C. § 2241) and to use it as the touchstone for an interpretation of the rest of the Act that would vitiate its operation insofar as it affects federal detainers, since virtually all federal transfers are conducted pursuant to the writ.27 This, in turn, would substantially impair the operation of the Agreement as a whole, since federal detainers form a large percentage of all detainers outstanding.28 Given this choice, we are constrained to hold that, whether or not a writ of habeas corpus ad prosequendum constitutes a “detainer,” see United States v. Mauro, supra, once a federal detainer has been lodged against a state prisoner the habeas writ constitutes a “written request for temporary custody” within the meaning of Article IV of the Detainers Act.
Turning to whether the government violated the limitations of the Act in this case, Article IV(e) provides:
“If trial is not had on any indictment, information, or complaint contemplated hereby prior to the prisoner’s being returned to the original place of imprisonment pursuant to article V(e), hereof, such indictment, information, or complaint shall not be of any further force or effect, and the court shall enter an order dismissing the same with prejudice.”
Appellant argues that the government violated this provision by returning him to Massachusetts custody on June 14, 1974, prior to trial. The provision, however, which is intended to avoid the disruptions in a prisoner’s rehabilitation occasioned by repeated transfers between jurisdictions, is thus for his benefit and is waivable. Here, appellant himself requested the transfer and by doing so waived his objection to it under Article IV(e)29
Article IV(c), however, provides in addition that:
“[T]rial shall be commenced within one hundred and twenty days of the arrival of the prisoner in the receiving State, but for good cause shown in open court, the prisoner or his counsel being present, the court having jurisdiction of the matter may grant any necessary or reasonable continuance.”
Although appellant waived his right not to be returned prior to trial, he did not thereby waive his right to a speedy trial. On the contrary, beginning shortly after his arrest he repeatedly insisted on a prompt trial. Almost immediately after his arrest he sent a letter to the United States Attorney requesting that he be tried as expeditiously as possible. He objected to each continuance or delay in the trial when he was afforded an opportunity to object and twice moved for dismissal on speedy trial grounds. His request to be returned to Massachusetts custody was made only after it became evident that trial would be substantially delayed at the government’s request.
Custody of appellant was obtained pursuant to the writ on April 1, 1974. Appellant was not tried until September 2, 1975, more than 13 months beyond the expiration on July 30, 1974, of the 120 days permitted under Article IV(c). The question, there*743fore, is whether the 120-day period was extended through the granting of “necessary or reasonable” continuances, “for good cause shown in open court, the prisoner or his counsel being present.”
Trial was originally set for May 28, 1974, well within the 120-day period. In response to the government’s request for a continuance in which to attempt to apprehend appellant’s co-defendant, however, trial was postponed to August 21, 1974. The proceeding took place in open court, with both the defendant and his counsel present. The government’s reasons for requesting the adjournment were set forth in a sealed affidavit filed with the court. While we do not believe that the public interest would be served by disclosure of the contents of that affidavit, we have reviewed it and hold that the continuance was “necessary” and “reasonable” and was granted “for good cause.” The later delay from November 18 to February 18, 1975, also supported by sealed affidavit and also granted in open court, was similarly justified.30
The remaining delays, however, cannot be so justified. When Judge Bauman resigned and the case was transferred to Judge Motley, the trial date was postponed from August 21 to November 18, 1974, without explanation. Part of this delay may have been occasioned by the transfer of the case. The larger part, however, can only be accounted for on the assumption that Judge Motley’s calendar was already full. As we have previously stated, under such circumstances it is the responsibility of the trial judge to reassign cases to assure defendants their right to a speedy trial. United States v. Drummond, 511 F.2d 1049, 1053 (2d Cir.), cert. denied, 423 U.S. 844, 96 S.Ct. 81, 46 L.Ed.2d 65 (1975). Similarly on February 18, 1975, the trial date set after the government’s second motion for a continuance, the trial judge found herself in the middle of another trial and, instead of reassigning the case to a judge able to accord the defendant a prompt trial, postponed the trial to June 11, 1975. Subsequently, because of a program undertaken by the court to dispose of civil cases, the trial judge sua sponte set a new trial date of September 2, 1975. None of these delays, which together total over nine months, were “necessary,” “reasonable,” or “for good cause” within the meaning of Article IV(c).
Not only were the delays unjustified, but two of the three were not granted “in open court, the defendant or his counsel being present.” Both the adjournment from August 21 to November 18, 1974, and the adjournment from June 11 to September 2, 1975, were granted sua sponte without any type of formal hearing. We have previously emphasized, outside of the context of the Detainers Act, the importance of granting the defendant an opportunity to be heard before granting an extended criminal trial continuance. United States v. Didier, 542 F.2d 1182, 1189 (2d Cir.1976). The Detainers Act imposes similar requirements for similar reasons: unless the defendant is given an opportunity to participate, his speedy trial rights may be whittled away in the non-adversary context of ex parte communications between the government and the court. We therefore hold that appellant’s rights to a speedy trial under Article IV(c) of the Detainers Act were violated here.
We are left with the question of whether such violations warrant reversal of the convictions below. Article V(c) of the Detainers Act dictates the answer:
“[I]n the event that an action on the indictment, information, or complaint on the basis of which the detainer has been lodged is not brought to trial within the period provided in article III or article IV hereof, the appropriate court of the jurisdiction where the indictment, information, or complaint has been pending shali enter an order dismissing the same with prejudice, and any detainer based thereon *744shall cease to be of any force or effect.” (Emphasis supplied).
Whatever might be our conclusion if such a provision did not exist,31 the language actually enacted is mandatory on this court. We therefore reverse the conviction and remand the case for dismissal of the indictment with prejudice.