
645 P.2d 383 (1982)
STATE ex rel., INTAKE WATER CO., a Delaware Corporation Plaintiff and Relator and Appellant,
v.
BOARD OF NATURAL RESOURCES & CONSERVATION Of the STATE OF MONTANA et al., Defendants, Respondents and Respondents, and
Utah International, Incorporated, a Delaware Corporation, Defendant, Respondent and Respondent.
No. 81-209.
Supreme Court of Montana.
Submitted February 26, 1982.
Decided April 15, 1982.
Rehearing Denied May 13, 1982.
*384 Henry Loble, argued, and Peter Pauly, argued, Loble and Pauly, Helena, for plaintiff and relator and appellant.
Donald MacIntyre, Dept. of Natural Resources, argued, Helena, for defendants, respondents and respondents.
Poore, Roth, Robinson, Urban L. Roth, argued, Butte, for defendant, respondent and respondent.
HASWELL, Chief Justice.
Relator Intake Water Company filed a petition for a writ of mandate to compel the Board of Natural Resources and Conservation and the Department of Natural Resources and Conservation to assign a priority date of January 14, 1975, to the water rights application of defendant Utah International, Inc. The District Court dismissed Intake's petition. We affirm.
On November 20, 1973, Utah filed its application in Wyoming, on Wyoming forms, to appropriate 106,730 acre feet from the Powder River, one of the rivers subject to the Yellowstone River Compact, section 85-20-101 et seq., MCA. The water was to be diverted in Wyoming for ultimate uses in Montana which include industrial, irrigation, municipal and recreation.
Pursuant to Art. VII B of the Compact, the Wyoming state engineer sent duplicates of Utah's application to Montana which were received by the Department on December 4, 1973.
Article VII B & C provide as follows:
"B. Each claim hereafter initiated for an appropriation of water in one signatory state for use in another signatory state shall be filed in the office of the state engineer of the signatory state in which the water is to be diverted, and a duplicate copy of the application or notice shall be filed in the office of the state engineer of the signatory state in which the water is to be used.
"C. Appropriations may hereafter be adjudicated in the state in which the water is diverted, and where a portion or all of the lands irrigated are in another signatory state, such adjudications shall be confirmed in that state by the proper authority. Each adjudication is to conform with the laws of the state where the water is diverted and shall be recorded in the county and state where the water is used."
These duplicates contained much of the same information that is required on the Montana forms.
On March 15, 1974, the Department notified Utah that if it filed the information for *385 the same project on Montana's forms, the priority date of November 20, 1973, would be retained. The Department noted that the filing would be pursuant to sections 85-2-301 and 85-2-302, MCA, the latter of which provides in pertinent part:
"The department shall return a defective application for correction or completion together with the reasons for returning it. An application does not lose priority of filing because of defects, if the application is corrected, completed, and refiled with the department within 30 days after its return to the applicant or within a further time as the department may allow. If an application is not corrected and completed within 30 days or within a further time as the department allows, up to 18 months, the priority date of the application shall be the date of refiling the application with the corrections with the department. An application not corrected within 18 months shall be terminated." (Emphasis added.)
On April 4, 1974, Utah replied that they intended to file applications for beneficial water use permits on the forms prescribed by Montana.
On September 27, 1974, Intake filed a Montana application with the Department and simultaneously filed a Wyoming application with the Wyoming state engineer. Duplicates of each application were filed in the other state at the same time. Intake plans to divert (for industrial, municipal, irrigation and other uses) 564,400 acre feet from the Powder River in Montana by a dam and resulting reservoir which will extend from Montana into Wyoming.
On November 13, 1974, the Department informed Utah that the Department had not yet received the applications for permits to appropriate the water on the Montana forms. On January 14, 1975, Utah filed the appropriate forms and paid the filing fee. The Department assigned Utah the Wyoming priority date of November 20, 1973. Intake made repeated demands upon the Department to change the priority date that had been assigned to the applications filed by Utah, contending that the priority date should have been the date that the corrected documents were filed with the Department, January 14, 1975. The Department refused to do so.
On March 6, 1975, Intake filed an action with the District Court of Lewis and Clark County seeking a writ of mandate to compel the Board and the Department to assign a priority date of January 14, 1975, to Utah's application. On the same day the District Court issued an alternative writ of mandate requiring the Board and the Department to show cause why they had not assigned the requested priority date.
On August 21, 1975, plaintiff filed an amended application for writ of mandate and defendants filed a motion to quash and dismiss the action. About October 14, 1975 (and still within the time allowed by the State District Court for the parties to file briefs in response to the above motions and to answer interrogatories), Utah filed a declaratory judgment action against Intake in Federal District Court in Billings and asked that court to adjudicate the rights of both parties in their attempts to appropriate the Powder River waters, Utah Internat'l Inc. v. Intake Water Co. (1976), 484 F. Supp. 36.
On December 15, 1975, the State District Court stayed all proceedings in that court pending a ruling of the Federal District Court. The Federal District Court declined jurisdiction but construed the Yellowstone River Compact to require the application of Wyoming law and stated that Wyoming courts did not have sole jurisdiction, 484 F. Supp. at 45.
On January 8, 1980, the State District Court dissolved its stay and allowed further briefs and prehearing conferences. On February 25, 1981, after hearing, the District Court granted defendants' motions to quash and dismiss the amended application in a 20-page order in which the District Court found no clear legal duty under the Yellowstone River Compact or Montana water laws requiring the Department to assign the later priority date requested by Intake. On March 16, 1981, the District Court entered judgment dismissing with prejudice any further mandamus proceedings *386 by Intake but without prejudice to any other remedy Intake might have. Intake appeals.
The issue on appeal can be stated as follows: Should a writ of mandamus issue to require the Department to assign a priority date of January 14, 1975, to Utah's water rights application?
All parties agree that a writ of mandate can be used to compel the performance of an act which the law requires as a duty resulting from an office. Section 27-26-102, MCA, provides in pertinent part:
"When and by whom issued. (1) It may be issued by the supreme court or the district court or any judge of the district court to any inferior tribunal, corporation, board, or person to compel the performance of an act which the law specially enjoins as a duty resulting from an office ..."
It is equally clear that the writ will only issue where there has been a showing that a clear legal duty exists and there is no speedy or adequate remedy in the ordinary course of law. Cain v. Department of Health (1978), 177 Mont. 448, 582 P.2d 332.
The basic thrust of Intake's argument is that Montana's Water Use Act controls over the Compact, mandating the assignment of the January 14, 1975, priority date. Intake argues that there are various reasons why a writ of mandate lies in the instant suit.
First, Intake contends that a writ of mandate lies to compel the performance of a nondiscretionary act, McCarten v. Sanderson (1941), 111 Mont. 407, 109 P.2d 1108, and the assignment of Utah's priority date is such an act. Intake further cites sections of Montana's Water Use Act and reasons that the Department has no discretion to assign an earlier date than the date Utah's applications were received on the Montana forms. These sections provide in pertinent part:
"85-2-401. Priority ...
"(2) Priority of appropriation made under this chapter dates from the filing of an application for a permit with the department ...
"85-2-302. Application for permit. Except as otherwise provided in (1) and (2) of 85-2-306, a person may not appropriate water or commence construction of diversion, impoundment, withdrawal, or distribution works therefor except by applying for and receiving a permit from the department. The application shall be made on a form prescribed by the department." (Emphasis added.)
Second, Intake argues that a writ of mandate is a proper remedy to compel the undoing of a thing wrongfully or improperly done that denies a person the rights to which he is entitled, citing State ex rel. Mallott v. Cascade Co. (1933), 94 Mont. 394, 22 P.2d 811. Other reasons given by Intake for the issuance of a writ of mandate include: if an agency follows a fundamentally wrong rule, the agency can be compelled to follow the law by mandamus, citing State ex rel. Bourquin v. State Board of Equalization (1923), 67 Mont. 340, 215 P. 667; and an agency has an implied legal duty to undo any action taken in violation of a statute, citing Parks v. Board of Co. Commissioners of Tillamook Co. (1972), 11 Or. App. 177, 501 P.2d 85.
Intake also argues that the application of Compact Article XVIII to Article VII (set out above) results in the conclusion that nothing in the Compact is intended to divest Montana of jurisdiction over its allocated waters and thus the provisions of Montana's Water Use Act should apply. Article XVIII provides as follows:
"Article XVIII
"No sentence, phrase, or clause in this compact or in any provision thereof shall be construed or interpreted to divest any signatory state or any of the agencies or officers of such states of the jurisdiction of the water of each state as apportioned in this compact."
The Board, the Department and Utah contend that a writ of mandate should not issue for several reasons. First, the Department did not violate any clear legal duty but followed the controlling laws of the Compact and Act. These parties reason *387 that the Compact is similar to a treaty, since it was approved by Congress, and state law is subordinate to it. Since Article VII, paragraph B, of the Compact states that the adjudication is to conform with the laws of the state of diversion, the Department correctly gave Utah the Wyoming priority date. These parties point out that in the Wyoming adjudication process, the priority dates relate back to the date of the application, i.e. November 20, 1973.
Also, these parties argue that a writ of mandate cannot issue because Intake has plain, speedy and adequate administrative remedies; that the Department did not follow a fundamentally wrong rule; and that a writ of mandate is not a proper remedy to undo an act already done. Finally, respondents contend that the Department did not divest itself of its jurisdiction of the water allocated to Montana under the Compact, i.e. the Department required Utah to correct its filings on the Montana forms insuring that water charged against its Compact allocation is beneficially used.
We note that this Court has recently addressed our scope of review on application for a writ of mandate:
"This Court is aware that a District Court's decision to grant or deny a writ of mandate is a matter of discretion and will be sustained on appeal in the absence of a showing of abuse of discretion." Ingram-Clevenger, Inc. v. Lewis and Clark County (Mont. 1981), 636 P.2d 1372, 1374, 38 St.Rep. 1696, 1699.
The District Court in this case did not abuse its discretion in denying the writ.
Here a writ of mandate cannot issue because there is no clear legal duty requiring the Department to assign Utah the January 14, 1975, priority date. Cain, supra. The Compact, signed by Wyoming, Montana and North Dakota and ratified by Congress (on October 20, 1951) has the status of a treaty and state law is subordinate to it. See Hinderlider v. LaPlata River & Cherry Creek Ditch Company (1938), 304 U.S. 92, 58 S.Ct. 803, 82 L.Ed. 1202 (an interstate compact between Colorado and New Mexico was found to be controlling over a Colorado State water decree). Thus, Montana's water statutes are subordinate to the Compact provisions.
Article VII, Section C, of the Compact provides that each adjudication must conform with the laws of the state where the water is diverted. Wyoming is the state of diversion in this case. Intake does not attack Utah's original filings in Wyoming on November 20, 1973. Thus, the Department correctly assigned the November 20, 1973, priority date to Utah in conformity with Wyoming law as required by the Compact.
Intake could not prevail even under Montana law. The Department is given the discretion under Montana's Water Use Act of allowing up to 18 months for a correction of defective filing. Utah filed the appropriate Montana forms with the Department within that period. The Department correctly assigned Utah the priority date of its first filing. It had no clear legal duty to do otherwise.
Affirmed.
DALY, HARRISON, SHEA, SHEEHY, MORRISON and WEBER, JJ., concur.
