
422 N.W.2d 768 (1988)
STATE of Minnesota, Respondent,
v.
Roger Riedel LEWIS, Appellant.
No. C7-87-2349.
Court of Appeals of Minnesota.
May 10, 1988.
*769 Hubert H. Humphrey, III, Atty. Gen., Robert A. Stanich, Asst. Atty. Gen., St. Paul, Julius E. Gernes, Winona County Atty., Winona, for respondent.
Roger Riedel LEWIS, pro se.
Considered and decided by FOLEY, P.J., and NORTON and MULALLY,[*] JJ., without oral argument.

OPINION
NORTON, Judge.
Roger Riedel Lewis appeals his conviction for aggravated DWI and selling a controlled substance without affixing appropriate tax stamps, and labels, claiming that the complaint should have been dismissed because the Interstate Agreement on Detainers (IAD) was violated. We affirm.

FACTS
Appellant was charged on September 12, 1986 by the Winona County Attorney with (I) possession of a controlled substance (cocaine), (II) being a dealer, possession of a controlled substance without affixing appropriate tax stamps, labels or other official indicia, and (III) aggravated DWI.
Following the institution of Winona County charges, an indictment was returned against appellant in federal court. On February 27, 1987, appellant pleaded guilty to count I of the federal indictment, namely, making a false statement in a passport application in violation of 18 U.S. C. § 1542. Appellant was sentenced in federal court to imprisonment for one year and one day.
He was thereafter confined at the Federal Medical Center in Rochester, Minnesota for treatment for his severe chemical dependency, as well as post-traumatic stress disorder which related to his military service in Vietnam. Shortly after the institution of the court proceedings, appellant also began receiving treatment at the Veteran's Administration Hospital in St. Cloud. Throughout the state court proceedings the prosecutor and the court complied with defense counsel's repeated requests to schedule court proceedings to avoid interference with appellant's ongoing treatment.
In June 1987, the Winona County Attorney placed a detainer on appellant at the Federal Medical Center, pursuant to Article IV of the IAD. Appellant requested final disposition of the Winona County charges, pursuant to Article III of the agreement.
Appellant was transferred to the custody of the Winona County Sheriff on July 22, 1987. On July 23, 1987, appellant waived a jury and proceeded to trial. The trial lasted less than one day. The trial court found appellant guilty on all three counts and entered judgment of conviction. Sentencing was scheduled for September 2, 1987.
Immediately after the trial, appellant was remanded to the custody of the sheriff for return to the custody of the United States Attorney General at the Federal Medical Center in Rochester. Appellant did not object to his return to the Federal Medical Center.
On August 20, 1987, appellant moved to dismiss the complaint on the ground that his return to the Federal Medical Center following the trial but before sentencing violated Articles III(d), IV(e) and V(c) of the IAD.
At appellant's request, sentencing was continued to September 21, 1987 at which time the motion to dismiss was fully argued. The court denied the motion, stating:
Given the accommodations and coordination that has been required between the Federal authority and the State authority in the proceedings here, most of which has been cooperative and much of which has been geared to accommodate the availability and convenience of the Defendant and his counsel, the Court is satisfied that no substantial right of the *770 Defendant has been violated, and accordingly upon the entire file and record herein, the Court having had the benefit of the arguments of counsel and being otherwise fully advised in the premises, the pending motion should be and it is hereby in all respects denied.
The court sentenced appellant to 34 months in prison. With respect to the charge of the sale of controlled substances without affixing tax stamps, the court dispositionally departed from the presumptive prison sentence, staying execution of sentence and placing appellant on five years probation.

ISSUE
Did the trial court err by refusing to dismiss the complaint for an alleged violation of the Interstate Agreement on Detainers where the defendant was returned to the custody of federal authorities pending sentencing?

ANALYSIS
The State of Minnesota and the federal government are party "states" to the Interstate Agreement on Detainers by virtue of Minn.Stat. § 629.294 (1986); 18 U.S.C.A. App. § 2 (West 1985). The purpose of the agreement, set out in Article I, is to provide cooperative procedures between party jurisdictions to protect a prisoner's right to a speedy trial and to remove "uncertainties which obstruct programs of prisoner treatment and rehabilitation." Id.; See Rhodes v. Schoen, 574 F.2d 968, 969 (8th Cir.), cert. denied, 439 U.S. 868, 99 S.Ct. 195, 58 L.Ed. 2d 178 (1978).
Appellant argues that the IAD requires the state charges be dismissed because he was returned to his original place of imprisonment without having been sentenced. Article III(d) provides in part:
If trial is not had on any indictment, information, or complaint contemplated hereby prior to the return of the prisoner to the original place of imprisonment, 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.
Id. Article IV(e) and V(c) contain similar provisions requiring dismissal of untried charges. Id.
Appellant relies principally on Walker v. King, 448 F.Supp. 580 (S.D.N.Y.1978) where the federal district court granted a writ of habeas corpus compelling the state of New York to dismiss its charges. The state had taken custody of a federal prisoner to try its indictment but returned him to his original place of imprisonment before sentencing. Id. at 582-83. The court held that the agreement permits only one transfer of a prisoner between party states and that "Final disposition cannot fail to include sentencing." Id. at 586-87. See also Tinghitella v. State of California, 718 F.2d 308, 311 (9th Cir.1983) (terms "trial" and "final disposition" as used in IAD include sentencing).
Respondent argues that the plain language of the agreement is controlling. See Minn.Stat. § 645.08(1) (1986); 645.16 (1986); United States v. Williams, 502 F.Supp. 721, 724-25 (W.D.Pa.1980) (plain language of the IAD refers to "trial" but, regardless of Walker decision, counsel could not be faulted for interpreting term in its ordinary sense and for failure to construe it to include sentencing).
Respondent argues that Walker is not controlling because the Southern District of New York is in a minority of jurisdictions which hold that the term "trial" as used in the agreement does not include sentencing. The state points to several federal cases which hold that dismissal of the complaint is unwarranted where the pre-trial return is brief or furthers rehabilitation, even if there is a technical violation of the agreement. See Sassoon v. Stynchombe, 654 F.2d 371 (5th Cir.1981); United States v. Chico, 558 F.2d 1047 (2nd Cir.1977), cert. denied, 436 U.S. 947, 98 S.Ct. 2850, 56 L.Ed.2d 788 (1978); United States v. Roy, 597 F.Supp. 1210 (D.Conn. 1984), aff'd, 771 F.2d 54 (2nd Cir.1985), cert. denied, Roy v. United States, 475 U.S. 1110, 106 S.Ct. 1520, 89 L.Ed.2d 918 (1986); United States v. Schrum, 504 F.Supp. 23 (D.Kan.1980), aff'd, 638 F.2d 214 (10th Cir.1981).
*771 In Chico, the defendants were confined in Connecticut state prisons when a federal grand jury returned indictments against them. Chico, 558 F.2d at 1048. They were brought to federal court for arraignment and returned the same day to the state prisons. Id. Later, each defendant was brought to federal court to enter a guilty plea and appear for sentencing. Id. Again, each was returned the same day to the state prisons from which they were taken. Id. The Second Circuit Court of Appeals upheld the trial court's refusal to vacate the convictions under the interstate compact because there was no interruption of their rehabilitative programs. Id. at 1049. They were removed for only a few hours and returned the same day. Id.
In Sassoon, a federal prisoner was not entitled to dismissal of state indictment where his brief removal and prompt return did not violate the prisoner's "legitimate interest." Sassoon, 654 F.2d at 374. He was removed to a county jail and five days later was arraigned and returned to the federal penitentiary. Id. at 373. Later, he was again removed for a two day trial and was not returned to the federal prison until several days had passed. Id. He was removed a third time for sentencing and returned the same day to the federal penitentiary. Id.
The Fifth Circuit Court of Appeals stated that "[c]onstrued literally, the detainer agreement entitled [the prisoner] to relief," however the court declined to dismiss the indictment because he was not injured by the technical violation of the agreement. Id. at 373-74. The court agreed with and quoted the Georgia Supreme Court:
This court declines to apply [Article IV(e)] mechanically contrary to the stated purposes of the Interstate Agreement on Detainers because such an application would be based upon a construction of the Agreement against, rather than in behalf of, the legitimate interest of Sassoon in receiving rehabilitative education while in federal custody. On the facts of the present case, Clayton County's keeping Sassoon for trial, rather than returning him immediately after arraignment, would have interfered with Sassoon's legitimate interest in participating in the program of rehabilitation in which he was enrolled. A brief removal of a prisoner to the receiving jurisdiction and his prompt return to the sending jurisdiction after arraignment and prior to trial is consonant with the intention of the Interstate Agreement on Detainers.
Id. at 375 (quoting State v. Sassoon, 240 Ga. 745, 749, 242 S.E.2d 121, 121 (1978)).
We agree with respondent's argument that the term "trial" in the IAD does not include sentencing. Additionally, the agreement should not be mechanically applied without an examination of the circumstances of the case in light of the purpose of the agreement. It is anomalous to apply the law so literally that its application subverts its very purpose. If the circumstances show that the technical application of the agreement does not serve one of the protective functions, it should not be so applied.
The underlying policies of the agreement were plainly served by appellant's return to the Federal Medical Center pending sentencing. Appellant spent only one night in the Winona County jail prior to his trial and he was immediately returned to federal custody. This expeditious handling of the detainer proceeding served to avoid the uncertainties of untried charges. His return to the Federal Medical Center furthered the purpose of minimizing interruption of his rehabilitation through treatment programs. Under appellant's approach, he would have awaited sentencing in the Winona County jail without the benefit of rehabilitative programs. He suffered no prejudice to his legitimate interests by being returned to federal custody pending sentencing.


*772 DECISION
The IAD was not violated because the term "trial" as it is used in the IAD does not include sentencing. Even if it were construed to include sentencing, the court's return of the prisoner to federal custody pending sentencing effectuated the purpose of the IAD, and was not an abuse which the agreement was designed to prevent.
Affirmed.
NOTES
[*]  Acting as judge of the Court of Appeals by appointment pursuant to Minn. Const. art. 6, § 2.
