George Christopulos, state engineer of the state of Wyoming (hereinafter referred to as the state engineer) and Robert Sun-din, director of the department of environ*263mental quality (DEQ) appeal from the decision of the district court of Laramie County, Wyoming granting summary judgment in favor of Husky Oil Company of Delaware (Husky), declaring that that company’s plan to impound and recycle effluent water, being the water remaining after use in its refinery process of water which it purchases from the city of Cheyenne, Wyoming, is not subject to the jurisdiction and control of the state engineer and the Wyoming state board of control (board). The summary judgment also declared that the proposed use did not infringe upon any rights of downstream water appropriators (intervenors) who had been permitted to intervene in the action, file answer and appear as active litigants. The city of Cheyenne, the original appropriator of the water sold to Husky, was not made a party to the action and no other party has sought its joinder. The city, acting through its board of public utilities (city), did not seek to intervene but claimed interest in the outcome and was granted leave to file a brief in the lower court as amicus curiae, which same privilege was extended to it in this court. Upon careful consideration of the briefs and arguments upon the motions for summary judgment, a majority of the court are of the opinion that both the state board of control and the city of Cheyenne are necessary and indispensable parties to the action if the issues asserted are to be adjudicated and that the cause should not proceed without their joinder. We are also of the opinion that after their joinder there should be a full factual trial upon the claims of all parties, including the interve-nors, before a final judgment is entered in the matter.
We take as a factual basis for the views herein expressed the following: The city has legally adjudicated water rights (1) to take, store and use virtually all the water developing in the Crow- Creek drainage, a stream having its source in the area west of Cheyenne and flowing through that city on down to lands which are owned and irrigated by the intervenors; (2) to take, store and use water produced through wells drilled in an area lying to the west of the city; and (3) to take, store and use a quantity of water diverted from another watershed a considerable distance from the city.1 All of these waters are commingled in the city municipal system, treated, and then distributed to various users within and near the city. For many years Husky has purchased from the city large amounts of water which it uses in its refinery operations conducted at Cheyenne.2 That part of the water which is used but not consumed in the refinery operations and which has to some extent been polluted by the refining process has throughout all this period of time been returned to Crow Creek and such amount as continues down that stream to lands of the intervenors has been used by them under adjudicated rights as early as 1888 and as late as 1970.3 A permit issued by the DEQ pursuant to federal and state authority is subject to the limitation that polluted water *264shall not be discharged into the stream after July 1, 1977. The downstream rights in part involve the direct flow of the stream but it is also claimed by intervenors that diminution of the flow of Crow Creek will have a direct and injurious effect upon ground water irrigation wells of some of the intervenors drilled in the so-called Carpenter Groundwater Control Area. At the argument hearing upon the motion for summary judgment the parties orally stipulated that for purposes of the argument only it could be considered that discontinuance of the discharge from the refinery would result in injury to the intervenors.
Husky’s principal contention is that the waters in question are not “unappropriated water subject to control and jurisdiction of the State Engineer of the State of Wyoming.” Its amended complaint raised the question that the state engineer was improperly asserting jurisdiction under the provisions of § 41-26, W.S.1957, requiring anyone seeking to impound the unappropriated waters of the state to apply for a permit from the state engineer. By their joint answer the state engineer and DEQ contend that Husky’s plan to impound waters which historically have been returned to Crow Creek “is a change and expansion of use, involving the storage of a direct flow water right which is within the jurisdiction and control of the State Engineer and the State Board of Control under Wyoming law.”4 (Emphasis added) The intervenors allege that they have vested rights in that portion of the effluent waters historically discharged into Crow Creek by the city of Cheyenne and by Husky. They also allege that Husky’s plan to impound rather than return the water is a change and expansion of use and storage of a direct-flow right under the jurisdiction of the state engineer and board of control. They ask that effectuation of such plan be enjoined and that Husky be ordered to treat and purify its effluent to comply with state standards and continue to discharge it to the stream.
From the foregoing we conclude that the issue involved in the case is whether the waters so diverted, impounded, treated and distributed by the city, including the portion sold to Husky, remain “waters of the State” or “unappropriated waters of the State,”5 subject to the jurisdiction and control of the state engineer and the board of control, acting in their respective fields of authority.6 The further issue is whether the intervenors have acquired such vested rights in the effluent discharge after Husky’s use that the plan to store proposed by Husky (presumably with the approval of the city) represents a change of use in derogation of intervenors’ rights.
Husky moved for summary judgment on the ground that there was no genuine issue of fact and it was entitled to judgment as a matter of law, submitting only an affidavit of its manager concerning the purchase and use of water by Husky. The state engineer and DEQ joined to file a cross-motion for summary judgment in their favor against *265both Husky and the intervenors.7 The motion was accompanied by affidavits that there were other adjudicated rights from Crow Creek below the point of discharge of Husky’s effluent, that the DEQ order did not require total impoundment as proposed by Husky, and such a system is acceptable to DEQ only if it “is legally available under all the statutes,” the legality of the plan to be determined by the discharger.
The city took no part in the proceedings until after the argument upon the motions for summary judgment. The following day the city, through its board of public utilities, asked permission to appear as amicus curiae, for the purpose of responding to questions as to whether the board was a necessary party to the action, to what extent the state engineer had jurisdiction over the municipal use of water, and whether customers of the board had absolute control of water sold to them unless and until the water was released into the natural channel of Crow Creek. In its brief the city generally supported the position of Husky that the state engineer was without jurisdiction, claiming that the use by Husky was a proper municipal use, that the water supplied to Husky came from a source foreign to Crow Creek in which intervenors had no priority, that there was no change in use and that the city was not a necessary party. Its comments in this last respect are significant because the city takes the position that it is not a necessary party if the case is disposed of on the grounds just mentioned but if “the Court should be inclined to hold that either 41-4.18 or 41-29.19 apply, then the Board would be a necessary party to this action.”10
After argument and consideration of briefs submitted by all the parties, as well as the amicus brief submitted in behalf of the city, the court sustained Husky’s motion for the reason that its plan
“ * * * to impound or recycle the effluent water which the Plaintiff purchases from the City of Cheyenne and uses in its refinery process is not subject to control and jurisdiction of the State Engineer of the State of Wyoming or the State Board of Control and does not infringe upon any rights of the Interven-ers.” (Emphasis added)
Section 1-1052, W.S.1957 permits an interested person whose rights, status or other legal relations are affected by a statute to have determined any question of construction or validity of the statute. This necessarily includes determination of the applicability of a particular statute to a particular set of facts. No one appears to question the applicability of the statute or its availability to Husky but § 1 — 1061, W.S. 1957 contains the pertinent direction that:
“When declaratory relief is sought, all persons shall be made parties who have or claim any interest which would be affected by the declaration, and no declaration shall prejudice the rights of persons not parties to the proceeding.” (Emphasis supplied)
All parties appear to proceed on the basis that if a change of use is to be granted or *266denied, it would be the board of control and not the state engineer who would make the decision. While the state engineer acts in the first instance to approve or deny a permit for the impoundment of water so that his inclusion as a party defendant to the action as filed by Husky was proper, no one has pointed to any authority to be exercised by him in connection with a change or expansion of use. Under the applicable statute, § 41-4.1, W.S.1957, 1975 Cum.Supp., he has no adjudicatory capacity with respect to the question whether Husky’s proposed action represents such a change or expansion of use, and if anyone other than a court has original or primary jurisdiction of that question, it is the board of control. It therefore seems clearly to come within that class of persons who have or claim an interest and it therefore necessarily follows that under the mandate of the declaratory judgment statute it shall be made a party. Since only the board may assert the right to adjudicate the claim of change of use contrary to Husky’s position upon the broadened issues of *the action, the board is the logical and only real defendant on this question. On this issue it is the board’s authority which is questioned, not the state engineer’s.
It is also clear that Rule 19(a)11 requires the presence of all who have a real interest in the disposition of the case, and we cannot conceive who might be more interested in a ruling as to the power and authority of the board than the board itself. We cannot avoid the conclusion that the presence of the board is mandated both by the statute and by the rule before any declarations can be entered concerning that authority. We know of no rule which permits the state engineer, even though he is constitutionally a member of the board and is statutorily the ex officio president thereof, to represent its interests in litigation of this kind.
Even more important to us is the absence of the city or its board of public utilities as a party to the suit. Nowhere in the record or briefs do we find any contention that there has been an assignment or other transfer of any part of the city’s water right or rights and it does not appear that by its purchase Husky has either temporarily or permanently succeeded to all or any part of the water right whereby this water becomes available to the city and through it to Husky. It is not inconceivable that compliance with the burden which the interve-nors ask the court (or might ask the board of control) to impose upon Husky’s disposition of the water which has served its purpose in the refinery process without consumption, or upon any alternative use that it might propose to make of the unconsumed water, could be sufficiently onerous to render uneconomic its purchase of water from the city. In that event negotiations for a different contract or abandonment of the existing contract of purchase could result. Termination of the contract could have serious effects upon the ability of the city to meet bond obligations and should the refinery operations be discontinued or Husky’s purchase of the water terminated for any reason it would be the city that would seek a new disposition for its water, perhaps one that was completely consumptive in its use, such as furnishing water to a brewery or manufacturer of soft drinks.
On the assumption that the city and Husky seek to make a change in the use of water appropriated by the city and sold by it to Husky, it is entirely probable that the legislature has vested primary jurisdiction in the board of control to determine whether such change of use should be permitted. But in this case Husky as a party and the city as amicus curiae contend that no *267change of use — at least a change of use that will adversely affect legal rights of other water users from Crow Creek — is to be effected. It is clear to us that the city’s ownership and use of the water right can be materially affected, yet without its presence as a party the state engineer would have us declare that a change of use is involved and the board of control alone has jurisdiction. The intervenors ask us to go further and declare that the change of use cannot be permitted because it will adversely affect their legal rights as appropriators from the stream. We have not been advised as to just how the administrative jurisdiction would be invoked since neither the city nor Husky is likely to make application for approval of a change of use which they do not recognize as such, but unless we make declarations that a change of use is contemplated and specifically direct application to the board of control, or declare that no legal change is contemplated and Husky’s proposed retention is legal, the real issues of the case concerning the authority of the board will not be decided. In either event then, we make a decision that is of the utmost importance to the city.
The claim of the intervenors that water which has historically returned to the stream so that others may use it must continue to return thereto and that a user of water may not change or expand that use so long as junior appropriators are injured thereby, is one that finds general supporting authority. One of the contentions in the city’s brief, not fully developed or explored, that water which has been brought into the watershed from a foreign source is not water in which other appropriators have any priority, represents a counter-proposal worthy of consideration. A number of questions must be answered before this litigation can be brought to a proper decision, and we would not be considered as favoring any side. All of the parties seem to find comfort in Wyoming Hereford Ranch v. Hammond Packing Company, 33 Wyo. 14, 236 P. 764 (1925), and it is true that there is much in that case which is pertinent to the dispute in this case. The point that we make is that any decision which we or the district court might enter herein, without a real factual basis upon which to proceed, and in the absence of the city which has a vital and continuing interest in the decision that is made, would be a holding as a matter of fact and of law that water which has been diverted, impounded, treated and distributed (only a part of which may be considered as coming from the direct flow of Crow Creek), and during the period of such use and before it has returned to any natural stream, spring, lake or other collection of still water, is to be treated as the property of the state and subject to its control and supervision through the board of control and the state engineer. We do not say that this may not be the proper construction of our constitution, statutes and former decisions of this court, but only that the owner of the water right, and not a purchaser, lessee or licensee or other party contracting with the city only for the purchase of a limited quantity thereof, must be a party to the proceedings if a just and proper decision is to be reached.
The disposition of this case has been disrupted by the naive and wholly unwarranted assumption of the city that it may appear as amicus curiae, submit its views through a brief and base its claim of interest or lack of interest in the suit upon whether the decision issued in the action is favorable or unfavorable to it. That is clearly not the intention of the declaratory judgment act nor of Rule 19(a), W.R.C.P. Those persons who are affected by the action are to be parties therein.
The principles concerning indispensable parties are not easy and there are many decisions defining the term. Our own court has considered the question in two fairly recent cases. American Beryllium & Oil Corporation v. Chase, 425 P.2d 66 (1967), and Oxley v. Mine and Smelter Supply Co., Wyo., 439 P.2d 661 (1968), in both of which the definition of an indispensable party is said to be:
“ * * * one without whose presence before the court a final decree could not be made without either affecting his interest *268or leaving the controversy in such a condition that its final determination might be wholly inconsistent with equity and good conscience. * * *” (Quotation from 439 P.2d at 663)
A series of four tests are set forth in these cases, a negative response in any one of which renders the absent party indispensable. These tests are (again quoting from 439 P.2d at 663):
“1. Is the interest of the absent party distinct and separable?
“2. In his absence can the court render judgment between the parties before it?
“3. Will the decree made in his absence have no injurious effect on his interests?
“4. Will the final determination in his absence be consistent with equity and good conscience?”
In the latter of these two cases it was held that the owner of mining claims was not an indispensable party to action to enforce claimed liens asserted not against the mining claims themselves or the owner’s interest therein, but only against whatever interest the parties defendant in the case had. Similarly, in the earlier case no title of the absent party was involved. While the statement of the rule in these two cases is unobjectionable, we do not think that application of the tests therein approved to the facts of this case can result in four affirmative answers. The claim is here advanced that Husky may not change or expand the use of the water right in derogation of the rights of downstream appropriators. The interests which Husky seeks to assert are inextricably tied into the ownership of the city of the water right and can be asserted only on the basis that the city as owner of the right could take the steps which Husky seeks to take. Perhaps the second question could be answered in the affirmative and the court could say that a judgment could be rendered as between Husky, the intervenors and the state engineer, but such a decision cannot cope with the real problem which deals with the water right itself and possible but stringent restrictions having to do with return of the water to the stream. Husky is not the alter-ego of the city nor is it the owner. Their interests insofar as this suit is concerned may be quite identical, but that clearly brings the case within the first test and their interests are not distinct and separable. No decision may be entered as to Husky which will not affect (at least as a matter of stare decisis) the decision that might be entered at such time as the city might see fit actively to protect its interest. In this situation the language in Metropolitan Denver Sewage v. Farmers Reservoir and Irrigation Company, 179 Colo. 36, 499 P.2d 1190, 1192 (1972) is most pertinent:
“In our view, the possession of the sewage in effluent by Metro is in the nature of possession by an agent, an agent for Denver. While no doubt Metro is an indispensable party here, the real party in interest is Denver. Whatever disposition Denver may make of the effluent, Metro can make; and whatever disposition Denver cannot make is proscribed to Metro.”
We think that the lack of an indispensable party is of such importance that we may properly raise the question on our own motion. Under Rule 12(h)(2), W.R.C.P. the defense of lack of indispensable party may be made at the trial on the merits and under Rule 12(h)(3) if it appears by suggestion of the parties or otherwise that the court lacks jurisdiction of the subject matter, the court shall dismiss the action. There are expressions of the courts that lack of an indispensable party results in lack of jurisdiction although this view has been criticized.12 In one of the earliest and *269most cited cases on the question of indispensable parties, Shields v. Barrow, 17 How. 130, 58 U.S. 130, 15 L.Ed. 158, 161 (1854). it is said:
“ * * * [A]s is observed by this court, in Mallow v. Hinde, 12 Wh., [193] 198, [25 U.S. 193, 6 L.Ed. 599] when speaking of a case where indispensable parties were not before the court, ‘we do not put this case upon the ground of jurisdiction, but upon a much broader ground, which must equally apply to all courts of equity, whatever may be their structure as to jurisdiction; we put it on the ground that no court can adjudicate directly upon a person’s right, without the party being either actually or constructively before the court.’ ”
The position we take may be inconsistent with that taken by this court in Wyoming Hereford Ranch v. Packing Company, 31 Wyo. 31, 222 P. 1027 (1923), discussing the question but reserving ruling on motion to dismiss the appeal because of the absence of the city until after consideration on the merits, and Wyoming Hereford Ranch v. Hammond Packing Company, supra, specifically holding that the city was not a necessary party to the appeal. The city had been a party to the action and had appeared therein, in the course of which a judgment was entered that a contract for the sale of certain water from the city to Hammond was invalid. The city did not appeal and in its final opinion concerning its necessity as a party in the appeal, this court said, 33 Wyo. at 44, 236 P. at 773:
“ * * * From what was said in that opinion on the motion, and in this opinion on the merits, we think it appears that the only question in issue with respect to the discharged sewage waters was a question between the plaintiff and the defendant packing company; the former contending that such waters became a part of the public waters subject to appropriation under the laws of the state, and the latter contending that it had a right to said waters by grant from the city. That question could have been determined without bringing the city into the case. The city, therefore, was not a necessary party, and the motion to dismiss will be denied.”
However, there is implicit throughout that case an element of lack of interest of the city. The waters had served their purpose insofar as the city was concerned and the court was careful to point out that the city had filed what amounted to a disclaimer in the action, the judgment could be taken as a dismissal of the city, and it appeared to be satisfied with the judgment and had not sought to be a party to the appeal. In the present case the city has actively, although as yet only through briefs as amicus curiae, asserted its material interest in the outcome of the action and has indicated its strong support of a position contrary to that of the state authorities and the intervenors.
While not directly in point, the disposition by this court Of Mountain West Farm Bureau Mutual Insurance Company, Inc. v. Hallmark Insurance Company, Wyo., 561 P.2d 706 (1977) is pertinent. We there denied jurisdiction of a suit to determine the respective liabilities of two insurance companies to their respective insureds when the plaintiff failed to place in evidence its own insurance policy, and rejected jurisdiction of another part of the action seeking construction of a “hold-harmless” agreement between the two insureds, not parties to the action. This is a rejection of any view that the court should consider rights between parties to the suit which can really not be settled without the presence of nonparties.
In 3A Moore’s Federal Practice, 2d Ed., ¶ 19.05, after pointing out the importance of the principle in the federal practice, the author proceeds (pp. 2209-2210):
“But the concept of indispensability goes beyond federal jurisdiction and touches the very power or the right of the court to make an equitable adjudication, where an indispensable party is not before it. In this situation, barring exceptional equities, it should not proceed without his joinder, * * *.”
After pointing out that Rule 12(h) permits the defense to be raised at the trial, the author continues (p. 2211):
*270“ * * * And the matter is so vital that an appellate court, sua sponte if necessary, may consider it although the point was not raised in the trial court. If the indispensable party can be joined, the ' court should ordinarily permit the joinder and not dismiss the action.”
Before closing, we would note that the dissent as expressed by Mr. Justice Raper, while arguing that the state board of control cannot be a party to the action, nevertheless concedes that the issues as originally posed by Husky have been considerably expanded by the answer in behalf of the state engineer and DEQ. As he points out, the answer, which for practical purposes could be treated as a counterclaim, specifically asserts the jurisdiction and authority of the board of control over Husky’s proposed actions. To us, this emphasizes the board’s vital interest in the outcome of the suit. Since the action is one for declaratory judgment and the court should make all declarations that will end the controversy, it does not seem important to us whether the questions are raised by answer or counterclaim, but the concept that the board’s interests can adequately and properly be represented by another party seems to us as novel and unacceptable as the proposition that the city’s interests are adequately and properly represented by Husky. We further note that in raising questions concerning the position of the board and the city in this declaratory judgment action the majority have not sought to give definitive answers and have not tried to foreclose the right of any of the parties, nonparties or the intervening downstream water users to secure binding and legal determinations of the many issues that appear to be involved. The far-reaching scope of the dissent of Mr. Justice Raper, as also that of the Chief Justice, and the answers they would give to those questions only confirm our view of the essential and inseparable connection of the city and the board of control with the questions raised. We do not say that those questions should not be answered; we only say that in good conscience and equity they should not be answered without the presence of parties that are vitally affected by those answers.
There is no reason why the city cannot easily be joined as a party nor do we see any reason why the board of control, or the members thereof, may not similarly be joined. The cause is remanded to the district court with directions to bring in the board of control or its members and the city of Cheyenne as parties, then proceed to develop the facts concerning the city’s appropriations, the use made thereof, and the proposed treatment of water by Husky through impoundment. It should certainly be determined whether, as alleged by Husky, this is to be part of a recycling process or, as seems to be contended by the state authorities and the intervenor, will result in complete evaporation of the water not now consumptively used in the refining process. On that factual basis, then, the court can enter its declarations whether a change of use is contemplated, whether the rights of intervenors are or may be affected, and what legal authority and jurisdiction the board of control has in the premises.
Reversed and remanded with instructions.
. The record contains a summary showing the amount of water received from the various sources for the years 1970 to 1976. For the last year listed it appears that of a total of 10,500 acre feet received into the city system, 7,300 acre feet or 70% of the supply was received through tunnel from western slope, 1,700 acre feet or 16% came from the Crow Creek drainage, and 1,500 acre feet or 14% came from the wells.
. The record discloses that during a typical period from July, 1975 to February, 1976, Husky’s purchases amounted to more than 49,-000,000 gallons of water per month, of which two-thirds was used and the balance, some 16,338,750 gallons, was discharged into Crow Creek.
.The dates of these appropriations do not appear in the record. Similarly, there is nothing in the record as to the dates of the city’s respective rights, although in Van Tassel Real Estate & Live Stock Co. v. City of Cheyenne, 49 Wyo. 333, 54 P.2d 906 (1936) reference is made to an adjudication of the right, entered in 1888, that awarded the city 12,481 cubic feet of water per second of time, “a much larger amount than the stream ever carried.” It is presumed that the tunnel diversion and the wells have later dates of priority, although as we shall subsequently indicate, the city has contended in its amicus curiae brief that such water is to be considered as developed water and not subject to the usual rules concerning return flow.
.Just what specific action the state engineer has taken or threatened is not made clear in the record. Husky refers to § 41-26, W.S.1957, relating to applications for permits to store water in reservoirs, as the basis of the state engineer’s claim of authority or jurisdiction, but his answer, as well as that of the interve-nors, refers to Husky’s action as amounting to a change and expansion of use, which is the subject of § 41-4.1, W..S.1957, 1975 Cum.Supp. As we read the briefs, both in the district court and here, the attorney general makes no claim that § 41-26 is pertinent, and we consider the real issues to be more aptly predicated on § 41-4.1.
. Section 1 of Article VIII of our Constitution declares “[t]he water of all natural streams, springs, lakes or other collections of still water, within the boundaries of the state” to be the property of the- state. Section 2 of this article vests the board of control, under such regulations as may be prescribed by law with the supervision of the waters of the state and their appropriation, distribution and diversion.
. Section 5 of Article VIII, vests the state engineer with “general supervision of the waters of the state.” We do not think that this provision was intended to give him an unlimited and uncontrolled authority thereover, and § 41-4.1, W.S.1957, 1975 Cum.Supp., relating to change of use, refers only to the board.
. The motion does not indicate just what kind, of a summary judgment should be entered, either as against Husky or as against the inter-venors. We conclude from the briefs that these state officials take the position that Husky’s petition should be dismissed, leaving it to the state engineer to exercise whatever jurisdiction he may have.
[8] Section 41-4.1, W.S.1957, 1975 Cum.Supp. relates to the change of use or change of place of use and requires the “owner of a water right” seeking such change to file a petition requesting permission therefor, and as I read it is directed to the board of control. The state engineer is not mentioned in the section.
[9] Section 41-29.1, W.S.1957, 1975 Cum.Supp. permits the owner of a direct-flow right under certain conditions to store such right, first submitting an application for such right to the state engineer and obtaining approval of the board of control.
. This quotation is from the city’s brief filed in the district court. Apparently the city’s counsel feels that if proper adjudications can be secured without its presence in the suit, there is no point in its being a party, but that its rights should not be adjudicated adversely without its presence. I know of no rule of law that permits a party to sit back and wait to see if he is hurt by the decision of the court and then assert an adverse interest.
. Rule 19(a), W.R.C.P. provides in pertinent part:
“(a) Persons to Be Joined if Feasible. A person who is subject to service of process shall be joined as a party in the action if (1) in his absence complete relief cannot be accorded among those already parties, or (2) he claims an interest relating to the subject of the action and is so situated that the disposition of the action in his absence may (i) as a practical matter impair or impede his ability to protect that interest or (ii) leave any of the persons already parties subject to a substantial risk of incurring double, multiple, or otherwise inconsistent obligations by reason of his claimed interest. * * * ”
. See Wright & Miller, Federal Practice and Procedure: Civil §§ 1610 and 1611. At page 115 it is said:
“Because an objection to the failure to join a person who should be regarded as indispensable under Rule 19(b) may be raised as late as on an appeal from a final judgment or by the court on its own motion, the impression is created that a failure to join is jurisdictional, for ordinarily only jurisdictional defects are treated in this fashion. Thus, it is not surprising that many cases can be found that speak of non-joinder as ousting the court of jurisdiction.”