
    (July 2, 1921.)
    THOMAS SANDERSON, Plaintiff, v. SALMON RIVER CANAL COMPANY, LIMITED, a Corporation, Defendant.
    [199 Pac. 999.]
    Carey Act — Water Contract — Use of Water — Settler’s Right— Mandamus to Compel Delivery of Water — Affidavit—Demurrer — Answer — Motion to Strike — Secretary of Interior — State Land Board — Commissioner of Reclamation — Refusal to Patent Land — Relinquishment by State — Effect on Water Right — Necessary Parties — Adverse Interests — Another Suit Pending.
    1. Demurrer on ground of nonjoinder of necessary parties, or another action pending, does not lie unless such facts appear on the face of the complaint or affidavit.
    2. Where plaintiff alleges that defendant, an operating company on a Carey Act project, has sufficient water available to furnish water to which he is entitled under his contract, defendant’s denial on the ground of laek of sufficient information to enable it to answer, is not sufficient to raise that issue.
    3. An affidavit alleging that plaintiff has a Carey Aet water contract, that he and his predecessors have used the water on land originally included under the project, that he has a crop which needs the water, that there is water available which could be delivered to him, that he has tendered the maintenance charges for the current irrigation season, but that defendant, the operating company, has refused to deliver the water on demand, sets forth a prima fade cause of aetion against the defendant in mandamus to compel delivery of the water.
    4. If plaintiff has a clear right to have water delivered to him by a company operating a canal and distributing water, if he has crops which are in need of such water and if the company has water which can be delivered to him, mandamus is the proper remedy.
    5. Mandamus is not a proper remedy to decide conflicting interests. If third parties have rights or interests adverse to those of plaintiff, mandamus is not the proper remedy. ■
    6. Under the Carey Aet contract between the construction company and the water users, as sanctioned by the federal and state governments, the water rights of all entrymen and contract holders are of equal rank.
    7. The right to a continued use of water arising from its beneficial use in the past under a Carey Act contract cannot be divested by aetion of the Secretary of the Interior, of the state land board, or of the commissioner of reclamation.
    8. Where plaintiff, an entryman on a Carey Aet project, has beneficially used water delivered to him under his contract, an agreement between the Secretary of the Interior and the state land board that only certain lands within the project shall be patented, that plaintiff’s land shall not be patented but relinquished by the state, and that the available water shall all be appurtenant to the lands selected for patent, does not divest plaintiff of his right to the continued use of the water. Such facts do not vest in the owners of the patented land any right to the use of the water superior to or adverse to the plaintiff’s.
    9. One who has appropriated water and beneficially used it has a right to use it independent of his ownership of the land.
    10. C. S., sec. 3018, cannot have the effect of making a water right an inseparable appurtenance of the land.
    11. The fact that plaintiff has not paid the purchase price under his contract is no defense to such action. It is sufficient if he has paid or tendered the maintenance charges for the current irrigation season. In such case the fact that the construction'company cannot enforce its lien on the land which the government refuses to patent is not a defense. It can foreclose on the water right if the plaintiff is in default under the contract and the law.
    12. Where an attack upon plaintiff’s water right and a claim of adverse interests of third parties are based solely upon the official acts mentioned in paragraph 8 of this syllabus, neither the officials mentioned nor the construction company, nor the owners of the patented lands are necessary parties.
    13. When allegations of an affirmative defense to an application for writ of mandate do not state any defense recognized by the law, they should be stricken on motion.
    14. An allegation in the answer that there is another action pending and undetermined in the state or federal court, involving the same parties and issues, raises a material issue.
    Original mandamus proceeding to compel delivery of irrigation water.
    Demurrer to affidavit overruled. Motion to strike from answer sustained.
    E'. M. Wolfe and J. F. Martin, for Plaintiff.
    
      Mandamus lies to compel the performance of an unqualified duty imposed by law, in this class of cases. (Gerber v. Nampa etc. Irr. Gist., 16 Ida. 22, 100 Pac. 88; Id., 19 Ida. 765, 116 Pac. 104; Furbee v. Alexander, 31 Ida. 738, 176 Pae. 97; Lewis v. Mountain Home Co-operative Irr. Co., 28 Ida. 682, 156 Pae. 419; State v. Twin Falls Canal Co., 21 Ida. 410, 121 Pac. 1039, L. R. A. 1916F, 236; Helphery v. Perrault, 12 Ida. 451, 86 Pac. 417; Beem v. Davis, 31 Ida. 730, 175 Pac. 959.)
    The fact that the injunction suit is pending in the district court does not constitute a defense in this case. (People v.
    
    
      Farmers’ High Line Canal & Reservoir Co., 25 Colo. 202, 54 Pac. 626; Miller v. Imperial Water Co., 156 Cal. 27, 103 Pac. 227, 24 L. R. A., N. S., 372.)
    Sham or irrelevant answer may be stricken out on motion. (C. S., sec. 6708; First Nat. Bank v. Ma/rtin, 6 Ida. 204, 55 Pac. 302.)
    
      “Ownership of a ditch and the water right for waters to flow through the ditch may, and often do, exist in different parties.” (Ada County Farmers’ Irr. Co. v. Farmers’ Canal Co., 5 Ida. 793, 51 Pac. 990, 40 L. R. A. 485; Swank v. Sweet-water Irr. & Power Co., Ltd., 15 Ida. 353, 98 Pac. 297; Parke v. Boultuare, 7 Ida. 490, 63 Pae. 1045; IIall v. Black-man, 8 Ida. 272, 68 Pac. 19.)
    "Where the proceeding is special, administrative in character, the conclusion of the officer rendering a decision therein does not conclude the rights of the parties, and they are left to their right of action in the courts. (Bear Lake County v. Budge, 9 Ida. 703, 108 Am. St. 179, 75 Pae. 614; Speer v. Stephenson, 16 Ida. 707, 102 Pac. 365; Sarret v. Hunter, 32 Ida. 536, 185 Pae. 1072.)
    Vested rights cannot be set aside by the department. (McCehee v. Mathis, 4 Wall. (U. S.) 143, 18 L. ed. 314; Fletcher v. Peck, 6 Cranch (U. S.), 87, 3 L. ed. 162; El Paso Brick Co. v. McKnight, 233 U. S. 250, 34 Sup. Ct. 498, 58 L. ed. 943, L. R. A. 1915A, 1113; Gornelms v. Kessel, 128 U. S. 456, 9 Sup. Ct. 122, 32 L. ed. 482; Hams v. State, 134 U. S. 1, 10 Sup. Ct. 504, 33 L. ed. 842; Lockwood v. Freeman, 15 Ida. 395, 98 Pae. 295; Card v. Thompson, 21 Ida. 485, 123 Pae. 497; Nielson v. Parker, 19 Ida. 727, 115 Pae. 488.)
    Failure to make payment for the water is not a cause for refusing mandamus. (Adams v. Twin Falls-Oakley Land & Water Co., 29 Ida. 357, 161 Pae. 322.)
    No person’s property can be taken without due process of law. (Fisher v. Bountiful City, 21 Utah, 29, 59 Pac. 520; Bennett v. Twin Falls etc. Co., 27 Ida. 643, 150 Pac. 336; Knowles v. New Sweden Irr. Dist., 16 Ida. 217, 101 Pac. 81; City of South Pasadena v. Pasadena Land & Water Co., 152 Cal. 579, 93 Pac. 490; El Paso Brick Co. v. McKnight, 233 U. S. 250, 34 Sup. Ct. 498, 58 L. ed. 943, L. R. A. 1915A, 1113.)
    
      James R. Bothwell, for Defendant.
    The Secretary of Interior and the commissioner of reclamation are necessary parties, and unless said officers be made defendants herein and their jurisdiction and authority determined, this defendant will be subject to conflicting orders and determinations from courts and executive and administrative officers of the state and federal government. (Twin Falls Salmon River Land & Water Co. v. Caldwell, 242 Fed. 177, 155 C. C. A. 17; Id., 272 Fed. 356.)
    “The right of appropriation must be exercised with some regard to the rights of the public. It is not an unrestricted right.” (Schodde v. Twin Falls Land & Water Co., 224 U. S. 107, 32 Sup. Ct. 470, 56 L. ed. 686, 1 Morr. Min. Rep. 683; Basey v. Gallagher,- 20 Wall. (U. S.) 670-683, 22 L. ed. 452-454; Yakima Development Co. v. State of Wash., 34 Land Dec. 453.)
    Turner K. Hackman, for Defendant. •
    “The writ of mandamus is a remedy to compel the performance of a duty required by law, where the party seeking the relief has no other legal remedy, and the duty sought to be enforced is clear, and indisputable. Both requisites must concur in every case.” (26 Cyc. 168; Territory ex rel. Crosby v. Crum, 13 Okl. 9, 73 Pac. 297.)
    The carrying out of the provisions of federal and state law is left to the executive branch of the government, and while acting in his administrative capacity an executive official should not be interfered with by the judicial branch of the government. This fundamental principle applies to the land office of the federal government and should apply with equal force to the executive branch and the reclamation bureau of the state government. (Quinby v. Conlan, 104 U. S. 420, 26 L. ed. 800; Wiseman v. Eastman, 21 Wash. 163, 57 Pac. 398; Michigan Land <& Lumber Co. v. Rust, 168 U. S. 589, 18 Sup. Ct. 208, 42 L. ed. 591; Steel v. St. Louis Smelting etc. Co., 106 H. S. 447, 1 Sup. Ct. 389, 27 L. ed. 226; Brown v. Hitchcock, 173 U. S. 473, 19 Sup. Ct. 485, 43 L. ed. 772; Lane v. United States ex rel. Mickadiet, 241 U. S. 201, 36 Sup. Ct. 599, 60 L. ed. 956.)
    Time, neglect or laches of federal or state officials does not estop either federal or state governments from taking such action as could have been taken in the first instance. {Utah Power & Light Co. v. United States, 243 U. S. 389, 409, 37 Sup. Ct. 387, 61 L. ed. 791, at 818; Pine River Logging & Improvement Co. v. United States, 186 U. S. 279, 22 Sup. Ct. 920, 46 L. ed. 1164; United States v. Insley, 130 U. S. 263, 9 Sup. Ct. 485, 32 L. ed. 968; Oregon & C. R. Co. v. United States, 238 U. S. 393, 425, 427, 433, 35 Sup. Ct. 908, 59 L. ed. 1360, 1392-1394.)
    The court cannot grant this writ for the reason that there are necessary and essential parties who are not before the court. (26 Cye. 415.)
    
      “Mandamus will not lie where the right to invoke the writ rests only on the allegations of the complaint, and it is apparent that the rights of many persons not before the court will be affected by its issuance.” {Stethem v. Skinner, 11 Ida. 374, 82 Pac. 451; Ramp v. State, 19 Wyo. 377, 118 Pac. 653; State ex rel. Gibson v. Stewart, 50 Mont. 404, 147 Pae. 276; Farmers’ Independent Ditch Co. v. Maxwell, 4 Colo. App. 477, 36 Pae. 556; Frost v. Alturas Water Co., 11 Ida. 294, 81 Pae. 996.)
    It cannot be said that the plaintiff has an actual settlement, improvement or possession, for the reason that he is upon an unpatented tract of land set apart under the Carey Act, and withdrawn from entry under the federal laws, and for which the government has refused patent because of noncompliance with the provisions of the Carey Act; plaintiff is subject to removal from said lands as a simple squatter and trespasser. {Mellen v. Great Western Beet Sugar Co., 21 Ida. 353, 358-360, Ann. Cas. 1913D, 621, 122 Pac. 30.)
    Richards & Haga, Amid Curiae.
    
    “The writ of mandamus issues only in case of necessity to prevent injustice or great injury. If there is a doubt of its necessity or propriety it will not go.” (26 Cyc. 146, and cases cited; State v. Hare, 78 Or. 540, 153 Pae. 790; State ex rel. Brickman v. Wilson, 123 Ala. 259, 26 So. 482, 45 L. R. A. 772; United States v. Lane, 249 U. S. 367, 39 Sup. Ct. 293, 63 L. ed. 650.)
    
      “Mandamus will not issue to enforce a right which is in substantial dispute, or which is inchoate or prospective or as to which a substantial doubt exists.” (26 Cyc. 153; State v. District Court, 29 Mont. 265, 74 Pae. 498; Williams v. Smith, 6 Cal. 91; Ex parte Karris, 52 Ala. 87, 23 Am. Rep. 559;. In re Key, 189 XL S. 84, 23 Sup. Ct. 624, 47 L. ed. 720.)
    “A writ of mandamus is never employed for the purpose of trying title to property, whether the property be a right to land, to an office, or to a-franchise.” (Gregory v. Blanchard, 98 Cal. 311, 33 Pac. 199; 26 Cyc. 157; 13 Eney. PL & Pr. 493; Commonwealth v. Bosseter, 2 Binn. (Pa.) 360, 4 Am. Dec. 451.)
    “The proceeding to obtain a writ of mandate should not be used to litigate or determine a permanent or perpetual water right.” (Lewis v. Mountain Kome Co-operative Irr. Co., 28 Ida. 682, 156 Pac. 419; Farmers’ Kigh Line Canal etc. Co. v. People, 8 Colo. App. 246, 45 Pae. 543; Townsend v. Fulton etc. Ditch Co., 17 Colo. 142, 29 Pae. 453.)
    The writ will not issue where the rights of third persons will be injuriously affected. (Farmers’ Kigh Line Canal etc. Co. v. People,- supra; Spurrier v. Neumiller, 37 Cal. App. 683, 174 Pac. 338; United States v. Edmunds, 5 Wall. (U. S.) 563, 18 L. ed. 692.)
    The fundamental purposes of the Carey Act cannot be defeated by requiring a Carey Act operating company to deliver water to lands which the government has declined to patent and which the state has relinquished to the government, and thus upset the determinations of the state officials and the Interior Department that the entire water supply should be used upon that portion of the original segregation which it was sufficient to reclaim. (Twin Falls etc. Water Co. v. Davis, 267 Fed. 382; Twin Falls etc. Co. v. Caldwell, 242 Fed. 177, 155 C. C. A. 17; 272 Fed. 356.)
    
      There is another action pending under which plaintiff can obtain adequate relief. (Goytino v. McAleer, 4 Cal. App. 655, 88 Pae. 991.)
    Notwithstanding delays incident to an appeal it constitutes an adequate remedy. {Olden v. Paxton, 27 Ida. 597, 150 Pae. 40; Blackwell Lumber Co. v. Flynn, 27 Ida. 632, 150 Pae. 42; St. Michael’s Monastery v. Steele, 30 Ida. 609, 167 Pac. 349; Fraser v. Davis, 29 Ida. 70, 156 Pac. 913, 158 Pac. 233.)
    W. L. Dunn, Amicus Curiae.
    
    “The contention that the water supply shall be divided and distributed over all the land now within the project, regardless of how small an amount would thereby be available for any portion of it, cannot be supported. ’ ’ {State v. Twin Falls Salmon River Land & Water Co., 30 Ida. 41, 73, 166 Pac. 220.)
    Rights did not become vested on account of state land board’s action. {Twin Falls Salmon River Land & Water Co. v. Davis, 267 Fed. 382.)
    “The proceeding to obtain a writ of mandate should not be used to litigate or determine a permanent or perpetual water right, as other actions are provided for by the statute in which such matters may be determined. And plaintiffs therefore have a plain, speedy and adequate remedy at law. ’ ’ {Lewis v. Mountain Some Co-operative Irr. Co., 28 Ida. 682, 156 Pac. 419.)
    S. T. Lowe and C. W. Thomas, Amici Curiae.
    
    The duty of distributing the water is imposed upon the canal company and it alone, and if the petitioner has any right to the water it is the duty of the canal company to deliver it. It is a duty imposed by law and can therefore be enforced by a writ of mandate. {Bardsly v. Boise Irr. etc. Co., 8 Ida. 155, 67 Pac. 428; City of Nampa v. Nampa & Meridian Irr. Dist., 23 Ida. 422, 131 Pac. 8; Gerber v. Nampa & Meridian Irr. Dist., 16 Ida. 22, 100 Pae. 88; Id., 19 Ida. 765, 116 Pae. 104; State v. Twin Falls Canal Co., 21 Ida. 410, 121 Pae. 1039, L. R. A. 1916F, 236; Combs v. Agricultural Ditch, Co., 17 Colo. 146, 31 Am. St. 275, 28 Pae. 966; Adams v. Twin Falls-Oakley Land & Water Go., 29 Ida. 357, 161 Pae. 322.)
    The fact that the settlers and consumers in this action do not have the title to the land does not prevent their acquiring a property right in and to the use of the water which they have applied to a beneficial use. (Hard v. Boise City Irr. é Land Go., 9 Ida. 589, 76 Pae. 331, 65 L. R. A. 407; Village of Hadley v. Riley, 14 Ida. 481, 95 Pac. 686, 17 L. R. A., N. S., 86.)
    A vested right was acquired by the settlers even though not the owners of the land upon which the same was used. (Const., sec. 4, art. 15; Niday v. Barker, 16 Ida. 73, 101 Pac. 254; Knowles v. New Sweden Irr. Dist., 16 Ida. 217, 101 Pae. 81.)
    A settler upon public lands of the United States may appropriate water and acquire the right to the use thereof, and such right is a vested property interest. (Hall v. Black-man, 8 Ida. 272; Sarret v. Hunter, 32 Ida. 536, 185 Pae. 1072; Kinney, Irrigation & Water Rights, see. 767; Hays v. Buzard, 31 Mont. 74, 77 Pac. 423.)
    The settlers on a Carey Act project having a vested right in and to the water actually applied by them to a beneficial use cannot be deprived of said waters by state land board by an order of elimination. (Kinney, Irrigation & Water Rights, sec. 768, and eases cited.)
    ‘ ‘ The land board is not a court of equity; it is an executive board charged with duties that must be executed in conformity with law.” (Balderston v. Brady, 17 Ida. 567, 107 Pae. 493; State v. Des Chutes Land Co., 64 Or. 167, 129 Pac. 764; Furbee v. Alexander, 31 Ida. 738, 176 Pac. 97; State v. CuiVoert, 56 Ohio St. 575, 60 Am. St. 756, 47 N. E. 551, 38 L. R. A. 519; Speer v. Stephenson, 16 Ida. 707, 102 Pae. 365; Lockwood v. Freeman, 15 Ida. 395, 98 Pac. 295; 22 R. C. L. 391, 392; Daniels v. Wagner, 237 U. S. 547, Ann. Cas. 1917A, 40, 35 Sup. Ct. 740, 59 L. ed. 1102; Johnston v. Little 
      
      Horse Greek Irr. Go., 13 Wyo. 208, 110 Am. St. 986, 79 Pac. 22, 70 L. R. A. 341.)
   MCCARTHY, J. —

Plaintiff filed his affidavit for writ of mandate in this court. The following are the material allegations of fact in the affidavit. The defendant is an Idaho corporation operating and managing the Salmon River Irrigation system, distributing the water of said system to persons holding water rights under it. It was organized by the Twin Falls Salmon River Land & Water Company, the construction or Carey Act company which built the system under contract with the state of Idaho. Plaintiff owns 80 shares of stock of both these companies. He owns as against everybody except the Hnited States government, and is in possession of, and entitled to the possession of, a certain tract of land in the Carey Act segregation known as the Salmon River tract and watered by the irrigation system constructed by the construction company and operated by the defendant. Water has been delivered to him by said company and used upon said land each year from 1913 to the present time. He has agricultural crops growing upon his land and the use of water from the system operated by defendant is necessary for said crops. The defendant has sufficient water available to supply plaintiff the two acre-feet to which he is entitled under his water contract and a system of canals and laterals by which said water can be delivered to the land of plaintiff. Before suit brought, plaintiff tendered to defendant the maintenance charge fixed by defendant for the use of water during the present irrigation season. Defendant has refused to deliver any water. Plaintiff applied for writ of mandate to one of the judges of the eleventh judicial district, in which said land is situated, and he denied such relief. Plaintiff prays for alternative writ of mandate requiring defendant to deliver to him his proportionate share of the water stored in its irrigation system for use upon his land during the present irrigation season up to the amount of 2% acre-feet which is the amount called for by his contract. An alternative writ of mandate issued out of this court.

Defendant demurs both generally and specially, also on grounds of nonjoinder of parties, and another action pending.

The points alleged in support of the general demurrer are that it does not appear that the plaintiff’s stock is appurtenant to the lands described in the affidavit; that it does not appear that plaintiff has succeeded to all the rights of the original holder of the stock, or that he has made a valid entry of the land, or that he has paid for his water right. Plaintiff alleges that the stock represents a water right for the land in question and that the water was used for several years on that land. While it is not specifically alleged that the original holder of the stock assigned his rights to the plaintiff, yet ownership in the plaintiff is • sufficiently set out by the allegation that he is the owner of 80 shares of the capital stock of the construction company and of the defendant. If an allegation of an interest in the land were necessary, paragraph 2 of the affidavit would suffice. But the plaintiff might have a valid water right even though the government refused to patent the land upon which the water had been used. Of this matter, and the authorities touching it, more will be said later in discussing the defendant’s answer. It is the settled law of this state that if a settler has a contract with a Carey Act company, uses the water on his land, and tenders the maintenance charges for the current year, the company cannot refuse to deliver the water simply on the ground that he has not paid or tendered the balance of the purchase price. The company’s remedy is to foreclose on the land and water right for failure to pay. (Adams v. Twin Falls etc. Co., 29 Ida. 357, 161 Pac. 322; Parrott v. Twin Falls etc. Co., 32 Ida. 759, 188 Pac. 451.) Defendant also demurs specially on the ground that the affidavit for the writ is ambiguous and uncertain in certain particulars. We conclude that this ground of demurrer is not well founded. Defendant also demurs on the ground that there is a defect of parties defendant in that it appears from the affidavit that the construction company, other water users under the project, and the original holder of plaintiff’s contract have an interest in the controversy and should be made parties. No such interest of any such parties appears on the face of the complaint. Finally, defendant demurs on the ground that there is another action pending between the same parties for the same cause. This is ground of demurrer only when it appears on the face of the complaint. (C. S., see. 6689.) It does not so appear in the affidavit. We conclude that the defendant’s demurrer to the plaintiff’s affidavit should be and it is overruled.

In its answer the defendant makes the following admissions: It is the holding or operating company operating and managing the Carey Act irrigation system constructed by the Twin Falls Salmon Biver Land & Water Company-under contract with the state of Idaho. It has an adequate system of canals and laterals to deliver water to the plaintiff’s land. Plaintiff tendered the maintenance fee; defendant declined to accept it, and declines to deliver water to plaintiff. Water is now being delivered as needed to other lands under the irrigation system. Defendant denies that plaintiff owns the land in question, and alleges that it is part of the public domain; that it was once segregated under the Carey Act but that the Secretary of the Interior has decided that it cannot be irrigated from the irrigation system and that patent for it will not issue to the state. Defendant alleges that this land has been relinquished by the state to the United States and is not now part of the land included in and to be watered by said irrigation system. Defendant admits that water was used upon said land from 1913 to the present, but alleges that it was furnished under the belief that the Secretary of the Interior would issue patent therefor. Defendant denies that agricultural crops are growing upon the land. For lack of sufficient information to enable it to answer the allegation that there is now stored in the reservoir and irrigation system sufficient water for irrigation of lands entitled to use water therefrom during the year 1921, defendant denies that allegation. Since the reservoir and irrigation system are being operated by the defendant such a denial is manifestly insufficient.

For an affirmative defense, designated as the second defense, the defendant makes the allegations which follow. The original Carey Act segregation under the defendant’s system comprised 127,000 acres of land. It was ultimately discovered that the amount of water available for said irrigation system was wholly insufficient to reclaim all of said lands. The Secretary of the Interior and the commissioner of the general land office determined that the water available was sufficient to reclaim only about 35,000 net irrigable acres of land and that out of the lands segregated only a gross acreage of approximately 39,000 acres should be patented to the state of Idaho and its assigns. The state of Idaho, acting through its board of land commissioners, and the Secretary of the Interior, selected the lands which could be reclaimed and were entitled to patent, and determined that the water supply under said irrigation system should be applied to them. These lands were patented upon the understanding between these officials that all the water available should be used upon them. Plaintiff’s lands are not among those so selected for patent. The state commissioner of reclamation has ordered and directed that the water available should be used exclusively upon the patented lands.

For a third defense defendant makes the allegations which follow. Plaintiff and his predecessors in interest have made no payments upon the purchase price of the water right. Defendant has no lien upon the land which the government has refused to patent. Under its contract with the construction company defendant is not to deliver water to any land if the owner has not paid for the same, or where the purchase price is not secured by a valid lien on the land. Plaintiff made his investment and improvements with notice that the Secretary of the Interior would decline to patent it. Defendant contends that to deliver water to the plaintiff under these circumstances would be a fraud upon the other water users whose lands are subject to a lien and upon the United States in that it would take water from the patented lands.

For a fourth defense defendant makes the allegations which follow. In 1914 plaintiff or its predecessors in interest in said land commenced a suit in the district court for Twin Falls county against the construction company and this defendant, which was removed to the United States district court for Idaho, in which, among other things, plaintiff sought to have it decreed that the available water supply should be confined to the lands for which patent has issued, and said suit is still pending.

For a fifth defense defendant makes the allegations which follow. If plaintiff has any water right, it is because of a contract between himself and the construction company. This defendant has no interest in that contract, but is charged with the duty of operating the system and delivering water to the persons entitled to use it. For these reasons defendant contends that the construction company is a necessary party. The water available is not sufficient for plaintiff’s needs and for the needs of the owners of the patented land. It is all claimed by the owners of the patented land and they are necessary and indispensable parties. This action involves the question of the power and control of Carey Act projects by the Secretary of the Interior and the state commissioner of reclamation, and they are necessary parties.

For a sixth defense defendant alleges that the plaintiff commenced an action in the district court for Twin Falls county against this defendant, for a writ of mandate, which raises the same issues as the present action, and which has not been finally determined, but is still pending in said court.

Plaintiff has moved to strike from defendant’s answer the second, third and fifth defenses on the ground that they do not constitute, or do not tend to constitute, any defense to the action.

It is the law of this state that if a water user has a clear right to have water delivered to him by a canal company, if he has crops which are in need of such water, and if the canal company has water which can be delivered to him, mandamus is the proper remedy. (Gerber v. Nampa etc. Irr. Dist., 16 Ida. 1, 22, 100 Pac. 80, 88; State v. Twin Falls Canal Co., 21 Ida. 410, 121 Pac. 1039, L. R. A. 1916F, 236; People v. Farmers’ etc. Canal etc. Co., 25 Colo. 202, 54 Pac. 626; Miller v. Imperial Water Co., 156 Cal. 27, 103 Pac. 227, 24 L. R. A., N. S., 372.) On the other hand, if the plaintiffs’ right to the water is not clear but doubtful, mandamus is not the proper remedy and he will be remitted to his suit in equity to establish his title. (Lewis v. Mt. Home etc. Co., 28 Ida. 682, 156 Pac. 419.) Mandamus is not a proper remedy to decide conflicting interests. Therefore, if the other parties mentioned in the answer have rights or interests adverse to those of plaintiff, to protect which they have a right to be heard in this action, mandamus is not the proper remedy. We will discuss these matters as they are raised by the answer and the motion to strike.

Defendant contends that the plaintiff has no right to the delivery of the water. The facts which it sets up in support of this contention in the second defense are, that there is not sufficient water for all the land under the project, that by agreement between the state land board and the Secretary of the Interior, the Secretary patented only 29,-000 acres with the understanding that all of the available water should be used upon it, and that the state commissioner of reclamation has ordered that all the water be used upon the patented land. This is no defense, for the following reasons. Under the contract between the construction company and the water users, as sanctioned by the federal and state governments, the water rights of all the entrymen and contract holders are of equal rank. The construction company in making the appropriation and completing the works acted for the settlers and contract holders. (Adams v. Twin Falls etc. Co., 29 Ida. 357, at 373, 161 Pac. 322; State v. Twin Falls etc. Co., 30 Ida. 41, 166 Pac. 220.)

“It was clearly the intention of the legislature, as well as the construction company, that the individual contract holder or settler should be the owner of the water right upon the completion of the construction works.” (Adams v. Twin Falls etc. Co., supra.)

Plaintiff’s contract with the company and the use of the water upon the land, by himself and predecessors, from 1913 to date, vest in him a water right of equal rank with that of any other entryman. (Knowles v. New Sweden Irr. Dist., 16 Ida. 217, at 227, 228, 101 Pac. 81.) The Secretary of the Interior had the power to decide what land should be patented and what should not, but he had no power to divest the plaintiff of his water right. Nor did the State Land Board or State Commissioner of Reclamation have any such power. It is fundamental that no executive officer or board has the power to deprive a party of a vested right to the use of water. (Speer v. Stephenson, 16 Ida. 707, 102 Pac. 365.) To permit this would clearly be depriving him of his property without due process of law. The contention that plaintiff’s water right necessarily fails because the government has refused to patent the land is not sound. One who has appropriated water and beneficially used it has a right to the use of the water independent of his ownership of the land. (Sarret v. Hunter, 32 Ida. 536, 185 Pac. 1072.) An owner of a water right by purchase or original appropriation may sell the water right separate and apart from his land. (Village of Hailey v. Riley, 14 Ida. 481, 95 Pac. 686, 17 L. R. A., N. S., 86; Bennett v. Twin Falls etc. Co., 27 Ida. 643, 150 Pac. 336.) C. S., sec. 3018, providing that water rights to all Carey Act lands shall attach to and become appurtenant to the land as soon as title passes from the United States to the state, does not and cannot have the effect of making the water right an inseparable appurtenance of the land. To give it such effect would be to render it unconstitutional. (Bennett v. Twin Falls etc. Co., supra.) It is thus clear that plaintiff has a water right which entitles him to the delivery of water and of which he cannot be divested by the Secretary of the Interior, the State Land Board, or State Commissioner of Reclamation. The second affirmative defense states no ground of defense.

The contention of defendants’ counsel that the federal courts have decided that the Secretary of the Interior and the state officers had the power to divest plaintiff of his water right is not borne out by the decisions. We have been referred to the following decisions: Twin Falls-Oakley Co. v. Martens, 271 Fed. 428; Twin Falls Salmon River etc. Co. v. Davis, 267 Fed. 382; Caldwell v. Twin Falls Salmon River Land & Water Co., 225 Fed. 584 (U. S. Dist. Court for Idaho); same case on appeal to the C. C. A., Twin Falls Salmon River Land etc. Co. v. Caldwell, 242 Fed. 177, 155 C. C. A. 17; same case on second appeal, 272 Fed. 356.

We find nothing in them to uphold this contention of defendant. The upshot of the whole matter' is that, after protracted litigation in the federal court, the proper parties have not been brought before that court to justify its taking jurisdiction of the question as to whether the water can be taken from the unpatented land and applied exclusively to the patented land. In Twin Falls-Oakley Co. v. Martens, supra, the court says:

“Many entrymen upon those lands have improved them, and, at least until after full opportunity is afforded such entrymen for hearing, we are not ready to say that, when they have complied with the law, they are to be put in a position where all the water must go to the patented lands, and that their lands may be rendered useless and their claim of vested rights ignored.”

In Twin Falls Salmon River etc. Co. v. Davis, supra, the circuit court of appeals said:

“The district court refrained from ruling upon the question of the power of the State Board or Department of Interior, over the objection of the settlers upon the excluded lands, to reduce the area of the project in the manner proposed, and, until that question directly arises, it should not be decided.”

The next point made by defendant, as outlined in the third affirmative defense, is that the plaintiff has not paid for his water right. This contention is disposed of in Adams v. Twin Falls etc. Co., supra, holding that under the Carey Act contract and the statutes the company cannot refuse to deliver water to one who has paid or tendered the maintenance charge simply on the ground that he has not paid for his water right or any instalment of the purchase price due under the contract, but is remitted to its action to foreclose the entryman’s interest in the land and the water right after default in payment. Defendant argues that this principle ought not to apply to the instant ease because, owing to the fact that the land office has refused to patent the land, and the state of Idaho has relinquished it to the federal government, the company cannot foreclose on the land. (Twin Falls Salmon River etc. Co. v. Davis, 267 Fed. 382.) The answer to this is that the company is not remediless, since it can foreclose on the water right, if the plaintiff is in default under the contract and the law. Since the Secretary of the Interior had no power to divest plaintiff of his right to use the water, the allegation that plaintiff knew, when he made improvements on the land, that the Secretary would not patent the land, is immaterial. It follows that the third affirmative defense states no ground of defense.

As a fourth affirmative defense defendant contends that there is another action pending in the federal court involving the same parties and the same issues as the present action. This tenders a proper issue in abatement.

As a fifth affirmative defense defendant contends that, on the facts set forth in the answer, the construction company, other water users and contract holders under the project, particularly those who own the patented land, and the Secretary of the Interior, members of the State Land Board, and State Commissioner of Reclamation, are all necessary parties to this action. The defendant is the representative of the construction company, incorporated by it for the purpose of distributing the water. The attack upon plaintiff’s water right and the claim of adverse interests of the owners of the patented lands are based solely upon the acts of the above-named officials. For reasons set forth above, these official acts cannot have the effect of divesting the plaintiff of any right or of investing the owners of the patented lands with any additional right, so far as the right to the water is concerned. For these reasons the facts set up in the fifth affirmative defense cast no doubt upon the validity of plaintiff’s water right, none of said parties are necessary or proper parties to this action, and mandamus is a proper remedy for plaintiff to invoke, although it would not be if any of said third parties were able to set up facts which, if true, would give them an adverse claim as against the plaintiff and thus tender a bona fide issue as to the plaintiff’s right.

In the sixth affirmative defense defendant sets up that there is another action pending in the district court for Twin Falls county involving the same parties and the same issues as the instant case, which has not been determined, and which is still pending. This presents a proper issue in abatement.

"We express no opinion upon the question, discussed in the oral argument, but not at present before us for decision, as to whether, by condemnation proceedings, or by any other remedy, the owners of the patented land, or an irrigation district formed by them, can acquire the water rights of the owners of the unpatented land. The facts set forth in the second, third and fifth affirmative defenses do not have the legal effect of divesting the plaintiff of the right to the delivery of water, to which the facts set up in the affidavit, at least prima facie, entitle him. (Gerber v. Nampa etc. Irr. Dist., supra.) The only proper issues tendered by the answer, so far as affirmative defenses are concerned, are those contained in the fourth and sixth affirmative defenses. As pointed out above, the denial of the allegation that agricultural crops were growing upon plaintiff’s land presents an issue, it being incumbent upon plaintiff to prove that allegation in order to entitle him to the writ of mandate.

The conclusion is that defendant’s demurrer to the plaintiffs’ affidavit is overruled, the plaintiff’s motion to strike from defendant’s answer is sustained. This leaves the ease at issue on the remaining issues, as outlined in this opinion.

Rice, C. J., and Budge, Dunn and Lee, JJ., concur.  