HENLEY, Circuit Judge.
Atlas Corporation appeals from orders of the district court denying without prejudice Atlas’ motion for restitution. We affirm.
Atlas contracted in 1973 to supply uranium oxide (U308 or yellowcake) to Iowa Electric for use in IE’s nuclear power plant. The contract, as modified in 1975, obligated Atlas to deliver specified quantities of uranium oxide in the years 1976-79. By the time deliveries were to begin, however, the market price of yellowcake had risen substantially. Atlas made deliveries in 1976 which, although untimely, were accepted by IE. IE was unsuccessful in obtaining assurances from Atlas that future deliveries would be made on schedule.
To ensure delivery of its 1977 supply of uranium oxide, IE brought a diversity action seeking preliminary and permanent injunctions ordering specific performance of the contract. Atlas moved to dismiss, alleging it had insufficient contacts with Iowa for the court to exercise in personam jurisdiction. This motion was denied by the district court on April 7, 1977.
In its answer to IE’s complaint, Atlas preserved its objections to the court’s jurisdiction and asserted, inter alia, that Atlas’ performance of the contract was commercially impracticable. Atlas also counterclaimed seeking an equitable adjustment of the contract’s price term.
A hearing was held on April 7-8, 1977 to consider IE’s request for a preliminary injunction requiring Atlas to make U308 deliveries for 1977 in accordance with the contract. At the hearing, the court indicated it was “not inclined to grant the injunction” because the exclusive remedy provision of the contract required IE to cover by buying uranium at market price. Pending its ruling on the request for preliminary relief, the court asked the parties if they would agree to confer in an attempt to resolve through negotiation, “the immediate problem IE has which is getting the uranium to protect its operations for the coming year.”
Atlas’ counsel responded to the court’s inquiry by stating,
The defendant is willing to commit to get all that material shipped ... to Iowa Electric .... We would accept payment at that point in time in the ordinary course under the original terms of the contract provided, however, that the Court would retain jurisdiction and make an equitable determination as to the price of this product ....
Pursuant to further discussions between the parties, an agreement based on Atlas’ offer was reached. The agreement called for Atlas to make all remaining deliveries under the contract. IE would pay for the uranium at the contract rate. The court would retain jurisdiction to make any necessary adjustment in the contract price term. The parties submitted to the court identical versions of a proposed order embodying the terms of their agreement. The district court approved this agreement and incorporated it in a “consent order” on April 18, 1977.
After a bench trial, the court found against Atlas on its counterclaim for adjustment of the contract price. Iowa Electric Light & Power Co. v. Atlas Corp., 467 F.Supp. 129 (N.D.Iowa 1978). Atlas appealed that decision, as well as the court’s ruling on in personam jurisdiction.
The court of appeals held that Atlas lacked minimum contacts with Iowa and was not subject to the in personam jurisdiction of the district court there. Iowa Electric Light & Power Co. v. Atlas Corp., 603 F.2d 1301 (8th Cir. 1979), cert. denied, 445 U.S. 911, 100 S.Ct. 1090, 63 L.Ed.2d 327 (1980). Accordingly, on September 27, 1979, the district court vacated its earlier judgment and dismissed the action.
On October 1,1979 Atlas filed a motion in the district court seeking “restitution.” Appellant asserted that, since the district court lacked in personam jurisdiction over Atlas, the “consent order” was void, and Atlas was entitled to be placed in the position it had been in on April 18, 1977. Atlas sought return of 508,200 pounds of uranium oxide or its market value of more than $16 million. In orders of May 6,1980 and June 26, 1980 the district court denied without prejudice Atlas’ request for restitution.
On the present appeal, Atlas challenges those orders, contending that if the district court had not erroneously exercised personal jurisdiction, Atlas would not have supplied the uranium and waived its right to require IE to cover.
Both parties agree that: the power is inherent in every court ... to undo what it had no authority to do originally ... and to restore, as far as possible, the parties to their former position. Jurisdiction to correct what had been wrongfully done must remain with the court so long as the parties and the case are properly before it, either in the first instance or when remanded to it by an appellate tribunal.
Northwestern Fuel Co. v. Brock, 139 U.S. 216, 219, 11 S.Ct. 523, 524, 35 L.Ed. 151 (1891). In exercising this power, courts have frequently held that, when a benefit has been conferred in compliance with a judgment subsequently reversed, restitution may be required. See, e. g., United States v. Morgan, 307 U.S. 183, 197-98, 59 S.Ct. 795, 802-03, 83 L.Ed. 1211 (1939); Atlantic Coast Line Railroad v. Florida, 295 U.S. 301, 309-10, 55 S.Ct. 713, 716-17, 79 L.Ed. 1451 (1935); Baltimore & Ohio Railroad v. United States, 279 U.S. 781, 785-87,49 S.Ct. 492, 493-94, 73 L.Ed. 954 (1929); Arkadelphia Milling Co. v. St. Louis Southwestern Railway, 249 U.S. 134, 145-46, 39 S.Ct. 237, 241—42, 63 L.Ed. 517 (1919); Middlewest Motor Freight Bureau v. United States, 433 F.2d 212 (8th Cir. 1970), cert. denied, 402 U.S. 999, 91 S.Ct. 2169, 29 L.Ed.2d 165 (1971). See also Restatement of Restitution § 74 (1937). This rule is founded upon basic equity concepts and is designed to prevent injustice. Atlantic Coast Line Railroad v. Florida, 295 U.S. at 309-10, 55 S.Ct. at 716-17.
The district court held that the rule did not apply in the circumstances of this case. The court found that the April 18, 1977 order embodied the terms of a voluntary agreement entered under no compulsion from the court. Because no benefit had been conferred as the result of an order or judgment, the court concluded that restitution was not appropriate.
We believe the district court’s analysis was sound. First, the record indicates that both parties and the court considered the agreement a voluntary modification of the terms of the existing contract. Despite the court’s indication that it was inclined to require IE to cover, Atlas offered, on the record, to supply the uranium. The terms of the agreement were reached through negotiations between the parties. Although the agreement was then submitted to the court for its “approval,” the court’s only interest was that the arrangement be satisfactory to the parties.
Atlas’ further argument that the April 18 agreement was compelled by the court’s ruling that it had jurisdiction over the parties is not persuasive. Although it is true that absent the court’s jurisdictional ruling the parties would not have been before the court, that ruling did not compel Atlas to supply the uranium or even to negotiate with IE. The April 7 ruling was no more than a procedural predicate to all subsequent proceedings; it simply put the parties under the power of the court.
The decision to supply the uranium was the result of Atlas’ own business and litigation strategy. Atlas opted to relinquish its right to require IE to cover in return for such equitable price adjustment as the court might later order. Whatever the relative benefits of this agreement to the parties, it is clear that the deal was reached through arms-length bargaining. Because the parties were not compelled to enter the agreement, Atlas has no right to restitution. See Morris v. SEC, 116 F.2d 896, 898 (2d Cir. 1941).
All that has been determined in this protracted litigation is that the district court in Iowa lacks in personam jurisdiction. Atlas is free to pursue any claim it may have against Iowa Electric, including equitable adjustment of the contract price, in any forum where IE may be served with process. Since there has been no decision on the merits, further litigation will not be barred by principles of res judicata.
The judgment of the district court, denying without prejudice appellant’s motion for restitution, is affirmed.
. The Honorable Edward J. McManus, Chief Judge, United States District Court for the Northern District of Iowa.
. Although IE’s request for preliminary relief ' involved only those shipments due in 1977, the agreement provided that Atlas would make all deliveries in 1977, 1978 and 1979 called for by the original contract.
. By this agreement Atlas waived its right to require IE to cover at the market price. IE’s request for an injunction requiring specific performance was mooted. Both parties have complied with the agreement.