This was an action for damages, alleged to have^been caused by obstructing the channel of the Boise river and thereby diverting the waters thereof on to the lands of respondent. The cause was tried by a jury, who awarded respondent $4,000 damages, for which judgment was entered. This appeal is from the judgment. No question is raised as to the sufficiency of the evidence, it being conceded by appellant that “if the legal questions raised will not defeat the action, we believe the evidence sufficient to support the verdict.”
The allegations of the complaint, so far as material, are briefly as follows: That respondent is a corporation and appellant is a municipal corporation; that respondent is the owner of certain lands riparian to the south bank of the Boise river, directly opposite and across the river from Boise City; that appellant is the owner of riparian lands along the north bank thereof; that these lands of appellant were held exclusively for park purposes and are known as the “Julia Davis Park”; that in 1910 respondent constructed a breakwater to protect its lands from erosion by the river and also maintained, outside of the breakwater, certain riprap for the same purpose; that in 1911 appellant, by its duly authorized officers and agents, devised a plan for the main*683tenance of the park, and,in June or July of that year commenced work thereon; that the plan included the construction of embankments, dams and riprapping to be placed upon and in the vicinity of appellant’s lands, in order to protect the park from overflow and erosion by the river, and included the filling of certain low lands then subject to overflow; that appellant thereafter constructed embankments, dams and riprapping and filled in upon and near its lands, and is continuing said work; that the work was performed in a negligent and careless manner and the dams, embankments, riprapping and filling were so placed as to obstruct the natural channel of the river and divert a large portion of the waters from the natural channel and interfere with the natural flow of the waters in the channel; and that the waters so interfered with and diverted were caused to flow against the lands, banks, ripraps and breakwater of respondent, causing the alleged damage to respondent’s property ; that the first damage therefrom occurred in April, 1912.
Appellant interposed a general demurrer -which was overruled, and thereafter filed its answer, denying all of the material allegations of the complaint and pleading as affirmative defenses; res adjudicate, election of remedies and the statute of limitations.
Error is assigned to the action of the court in overruling the demurrer and in denying and overruling the several affirmative pleas. The pleas of election of remedies and res adjudicata set up an adjudication in a former action between the same parties. It appears that when the city began the construction of its breakwater and embankments, the development company commenced an injunction suit, in order to prevent the damage which it believed would result to its property. In order to secure a dismissal of the injunction suit the city entered into a written contract, by the terms of which it was to adequately protect respondent’s lands. The city failing to comply with the terms of its contract an action was instituted for damages for its breach, culminating in the decision of this court to the effect that the contract was void because' in violation of sec. 3, art. 8, of the constitution *684of Idaho. (Boise Development Co. v. Boise City, 26 Ida. 347, 143 Pac. 531.)
It is contended by appellant that the action of respondent •in bringing the former suit on breach of the contract amounted to an election of remedies, and that having elected to sue upon that contract it cannot now sue in tort. But it is essential, in order to apply the doctrine of election of remedies, that the party must actually have had at his command more than one remedy. As was said by this court in an early case,
" He must not only think he has them, but must in fact have them.” (Elliott v. Collins, 6 Ida. 266, 55 Pac. 301.) The rule there announced was followed by this court in Whitley v. Spokane etc. Ry. Co., 23 Ida. 642-655, 132 Pac. 121. The latter case was cited with approval in Nave v. Powell (Ind. App.), 110 N. E. 1016-1020. Applying the rule to the facts in this case it is apparent that the plea of election of remedies must fail. Respondent sued for the breach of what it believed to be a contract, when as a matter of fact no such contract was in existence.
The defense of res adjudicate, is equally untenable. The former case, Boise Development Co. v. Boise City, supra, adjudicated the sole question that respondent’s pretended contract with the city was void. None of the matters at issue in this cause were affected by the judgment in the former. When a party, acting upon a mistaken theory as to his legal rights, brings his action and is defeated by reason thereof and afterward renews the litigation, basing his claim upon a correct theory, the former judgment is no bar to the second, action. (Black on Judgments, sec. 733; Hughes v. United States, 71 U. S. (4 Wall.) 232, 18 L. ed. 303; Freeman on Judgments, 4th ed., sec. 260; 23 Cyc. 1226; Keane v. Pittsburg etc. Min. Co., 17 Ida. 179-191, 105 Pac. 60; Rowell v. Smith, 123 Wis. 510, 3 Ann. Cas. 773, 102 N. W. 1; Russell v. Place, 94 U. S. 606, 24 L. ed. 214; Lockett v. Lindsay, 1 Ida. 324.) At most, the former case was “merely illusory and supposititious, and hence it cannot be considered as identical, in any just sense of the term, with the true cause of action *685correctly set up and supported by a right theory of the facts.” (Black on Judgments, see. 733.)
The defense of the statute of limitations is based upon subd. 2, sec. 4054, Rev. Codes, which limits the time within which an action may be brought for trespass upon real property to three years. That section has no application to the ease at bar. This is not an action for trespass on real property, but is an action on the case for consequential damages. The authorities cited both by appellant and respondent support this view. Appellant did not build its breakwater upon the land of respondent, but upon its own land, or at least where it had a lawful right to construct a breakwater, and this act did not constitute a trespass upon the lands of respondent. The resulting injury to respondent was necessarily consequential, and not the immediate result of any wrongful force directly applied by appellant to respondent’s lands. The very elements of trespass to real property are lacking. (Hicks v. Drew, 117 Cal. 305, 49 Pac. 189; Daneri v. Southern California Ry. Co., 122 Cal. 507, 55 Pac. 243; Crim v. City & County of San Francisco, 152 Cal. 279, 92 Pac. 640; Denney v. City of Everett, 46 Wash. 342, 123 Am. St. 934, 89 Pac. 934; Suter v. Wenatchee etc. Power Co., 35 Wash. 1, 102 Am. St. 881, 76 Pac. 298; 1 C. J. 996; 11 C. J. 4. For an instructive consideration of an action upon the case, see 1 Bouvier’s Law Dict., Rawle’s 3d ed., p. 425, citing numerous cases.)
Respondent has suggested that the sections of the code which govern this case are 4053 and 4060, respectively. We are inclined to the view that the latter section is the only one which has any application. It provides: “An action for relief not hereinbefore provided for, must be commenced within four years after the cause of action shall have accrued.” See. 4053, Rev. Codes, was evidently intended to limit actions upon contract or upon matters of a contractual nature, not founded upon a written instrument. Clearly, this case was not barred under either of these sections.
It is contended by appellant that the statute of limitations began to run in 1911, when the construction of the city’s breakwater was commenced, and not in April, 1912, when the *686first damage occurred, as contended by respondent. Where the damage is not a direct but only a consequential result of a defendant’s act no cause of action arises until injury has been done or actual damage inflicted. (Rogers v. Oregon-Washington Ry. & Nav. Co., 28 Ida. 609-624, 156 Pac. 98; Hill v. Empire State-Idaho Mining & Developing Co., 158 Fed. 881.) Respondent alleged, and in the face of the record it must be regarded as a determined fact, that the first damage was done in April, 1912, and following the rule announced in the cases last cited, the statute of limitations would not begin to run until that time. As this action was begun January 18, 1915, it is therefore apparent that there is no merit in appellant’s defense on this ground.
Appellant urges that in constructing the breakwater to protect its park it had no lawful authority to do any more than erect such a barrier as would prevent its lands from being overflowed or damaged, or such as would keep the river within its natural channel, and that its acts in going beyond what was necessary to accomplish this purpose and in placing within the stream obstructions which tended to divert the river from its natural channel, were ultra vires and beyond the scope of its powers, either express or implied. Sec. 42 of the Charter of Boise City, as amended by Sess. Laws 1909, p. 113, gives the mayor and common council power to establish, maintain and improve parks within or without the corporate limits of the city. The city would have implied authority to take whatever lawful means were necessary to accomplish this end. (Wilson v. Boise City, 6 Ida. 391, 55 Pac. 887.) While there is much conflict in the authorities as to just what acts of a municipal corporation are vdtra vires, the rule, applicable to the facts in this case, is generally well settled, and is stated by MeQuillin thus: “The defense of ultra vires can be interposed only where the act complained of was wholly beyond the powers of the municipality. If the wrongful act in question is one which the municipality had the right to do under some circumstances or in some manner, then it is not ultra vires.” (McQuillin, Mun. Corp., sec. 2637; Dillon, Mun. Corp., 5th ed., sec. 1648.) Even in the *687absence of the charter provisions above quoted the city would have an unquestionable legal right to erect such barriers as would adequately protect its property from the ravages of the river, but such right is subject to the same limitations as the same right of any other riparian owner. It is apparent that the action of the city in constructing its breakwater for the purpose of affording protection to its property was not an action wholly beyond the powers of the municipality. Under the circumstances, the city had the right to in some manner construct a breakwater, which would prevent the flooding, erosion and consequent damage to its lands. Having exercised that right, it cannot now be heard to defend upon the theory that some of the things or acts which it did in the exercise of that right were in excess of its lawful authority and ultra vires.
It remains to consider the chief objection urged by appellant to respondent’s right to recover. This question was raised by the appellant’s general demurrer. Appellant insists that even though the defenses of election of remedies, statute of limitations, res adjudícala and ultra vires should fail, still the city is not liable in any event. The contention is, that in building its breakwater for the purpose of protecting one of the city’s public parks the city was exercising a governmental function and would not be liable for any damage which might result from its action while in the exercise thereof. The extent to which municipalities are legally responsible for torts has been the subject of endless litigation. The result of the decisions from the various jurisdictions presents no rule which can be regarded as uniform. To attempt an analysis of these rules or to discuss the cases adhering to the various diverging rules would be a task altogether beyond the necessary scope of this opinion. Some jurisdictions make the test of the city’s liability depend upon whether or not the tort was one which arose in some business which the municipality was carrying on for which it receives some revenue, such as municipally owned waterworks, lighting systems, transportation facilities and the like.
*688An examination of our own decisions renders it clear that no such test can be regarded as decisive in determining the liability of municipalities for their torts in this state, for municipalities have uniformly been held liable in this jurisdiction for defective streets. (Carson v. City of Genesee, 9 Ida. 244, 108 Am. St. 127, 74 Pac. 862; Moreton v. St. Anthony, 9 Ida. 532, 75 Pac. 262; Miller v. Village of Mullan, 17 Ida. 28, 19 Ann. Cas. 1107, 104 Pac. 660; Powers v. Boise City, 22 Ida. 286, 125 Pac. 194; Village of Sandpoint v. Doyle, 11 Ida. 642, 83 Pac. 598, 4 L. R. A., N. S., 810; City of Kellogg v. McRae, 26 Ida. 73, 141 Pac. 86; Beaton v. City of St. Maries, 27 Ida. 638, 151 Pac. 996; Dillon, Mun. Corp., 5th ed., see. 1638 et seq.) In a certain sense any municipal function might be regarded as governmental, but the term, when properly applied to the subject here under consideration, should limit governmental functions to “legal duties imposed by the state upon its creature, which it may not omit with impunity but must perform at its peril.....They are all imposed by statute, and are necessarily mandatory or peremptory functions, .... The officers performing these duties and exercising these powers are rather officers of the state than of the municipality, and as such are liable to state control.” (28 Cyc. 267.) The celebrated case of Hill v. Boston, 122 Mass. 344, 23 Am. Rep. 332, wherein the subject is given a most scholarly review by Chief Justice Gray, although placing additional limitations upon municipal liability for torts, will be found, upon careful examination, under the facts there involved, not to be out of harmony with what we believe to be the more sound rule, above quoted from Cyc. In that case the injury complained of resulted from a defective stairway in one of the city’s school buildings. An imperative legal duty rested upon the city to maintain the schools and school buildings as a portion of the city school system. And while it is true that the opinion gave as an additional reason for its decision, that the corporation received no profit or special advantage from the performance of the legal duty, we are inclined to the view that this was placing an additional limitation upon the liability of the municipality neither *689strictly sound on principle nor necessarily involved under the particular facts of the ease. The previous decisions of our own court, while not expressly in point with the qase at bar, are strongly analagous in principle and are in harmony with the rule above announced. (Wilson v. Boise City, supra; Willson v. Boise City, 20 Ida. 133, 117 Pac. 115, 36 L. R. A., N S., 1158.)
The maintenance of public parks is not made an absolute or imperative duty by the provisions of the charter of Boise City here invoked. The mere grant to the city of power or authority to maintain a public park enjoins no absolute duty upon the city to do so, but merely confers the privilege by extending the lawful corporate authority of the city in such case. The care and maintenance of parks is primarily a private as opposed to a governmental function. (28 Cyc. 1311; City of Denver v. Spencer, 34 Colo. 270, 114 Am. St. 158, 7 Ann. Cas. 1042, 82 Pac. 590, 2 L. R. A., N. S., 147; Gartland v. New York Zoological Society, 135 App. Div. 163, 120 N. Y. Supp. 24; Capp v. City of St. Louis, 251 Mo. 345, Arm Cas. 1915C, 245, 158 S. W. 616, 46 L. R. A., N. S., 731; Weber v. City of Harrisburg, 216 Pa. St. 117, 64 Atl. 905; Lowe v. Salt Lake City, 13 Utah, 91, 57 Am, St. 708, 44 Pac. 1050; Mayor of Detroit v. Bark Commrs. (Moran), 44 Mich. 602, 7 N. W. 180.)
While there are cases which hold to a contrary doctrine, for the reasons above given we are satisfied that we are announcing the correct rule. Most of the cases touching the question of municipal liability for torts with respect to parks have arisen where the facts were materially different than in the case at bar. The question has usually arisen where some injury occurred within the park; manifestly those cases can throw little light upon the serious question here involved. The question here is whether or not the city has incurred liability by so constructing its breakwater as to cause resulting damage to the opposite riparian owner. As we view the matter, the character, class or kind of municipal property which it was sought to safeguard or protect by the construction of the breakwater has no material bearing upon the real *690issue. So far as the city’s liability in this case is concerned, it stands in no different situation than any other riparian owner. As such it had the undoubted right, if it so desired, to construct the breakwater for the protection of its property, but in so doing it had no right to so obstruct the stream as to divert it and injure the property of another riparian owner, and if damage resulted therefrom the city was clearly liable. (Geurkink v. City of Petaluma, 112 Cal. 306, 44 Pac. 570; Fischer v. Davis, 19 Ida. 493, 116 Pac. 412; 24 Ida. 216, 133 Pac. 910; Boise Development Co. v. Idaho Trust etc. Bank, 24 Ida. 36, 133 Pac. 916; Rogers v. Oregon-Washington R. & Nav. Co., supra; Hill v. City of Boston, supra; Hill v. Empire State-Idaho Mining & Development Co., supra.)
Nor does the city’s liability in such cases rest solely upon the narrow ground of negligence, but rather upon the broad legal principle that no one is permitted to so use his own property as to invade the property rights/ or cause injury or damage to the property of another. ✓(Dillon, Mun. Corp., 5th ed., sec. 1638; McQuillin, Mun. Corp., secs. 2702, 2704; Ordway v. Village of Canisteo, 66 Hun, 569, 21 N. Y. Supp. 835; Brown v. City of Ithaca, 148 App. Div. 477, 132 N. Y. Supp. 1041; Geurkink v. City of Petaluma, supra; Martin v. St. Joseph, 136 Mo. App. 316, 117 S. W. 94.)
Having examined all the material errors assigned, we are satisfied that every legal objection raised by appellant must be resolved in favor of respondent. The judgment is affirmed. Costs awarded to respondent.
Morgan, J., concurs in the conclusion reached. Rice, J., concurs.