delivered the opinion of the court.
As alleged in the amended complaint of plaintiff, a contract was entered into in August, 1879, between plaintiff and the defendant city, whereby the former agreed, for a period of twenty-five years, to light the streets, alleys and public places of the city for a stipulated sum of money, the street lamps and posts to be furnished and maintained by the city. This contract was evidenced by a city ordinance, passed in pursuance and by authority of a special city election previously held, as provided by the laws of the state then in force. It is further alleged that, some time after the contract went into effect, the city requested the plaintiff to maintain and keep in repair the street lamps and posts, and contracted to reimburse it therefor; that the plaintiff has fully complied on its part with the terms of said contract, *402but that the city has failed for a number of years to pay to plaintiff the full amount of the indebtedness accrued to it under said contract. This action is brought to recover judgment for such balance of indebtedness.
Five causes of action are set forth in the amended complaint, and to each defendant interposed a demurrer, which was sustained by the court, and, the plaintiff electing to stand by its complaint, judgment for defendant was rendered accordingly. Plaintiff comes here by writ of error.
Several grounds are set forth in defendant’s demurrer, but the only one urged upon our consideration is that the amended complaint did not state facts sufficient to constitute a cause of action. In fact, all of the special causes alleged are embraced in this general one.
No question is raised as to the validity or regularity of the special election or of the city ordinance.
It is claimed, in support of the demurrer, that the amended complaint, in order to constitute a cause of action, should have alleged a prior appropriation by the city to meet the expense to be incurred by and under the contract. This contention is based upon section 2671 of the General Laws of Colorado (1877), which was in force at the time when the contract was executed, and which is the same as section 4449, Mills’ Ann. Statutes. This provided in substance that no contract should be made nor expense be incurred by a city or any of its officers “ unless an appropriation shall have been previously made concerning such expense, except as herein otherwise expressly provided.”
The authority under which' this contract was executed is given in subdivisions 67-69 and 71 of section 2655 of the General Laws, 1877.
We do not believe that it was the intent of the legislature that the provisions of section 2671, supra, should apply to contracts like the one in question. To so hold would amount to a nullification of subdivisions 69 and 71 of section 2655, which expressly grant to cities and towns the power to make such contracts.
*403The lighting of a city is a paramount necessity for the comfort, convenience, and protection of its citizens in their persons and property. It is also a matter of general knowledge that it requires a large expenditure of money to establish the required plant and facilities for furnishing this light. If a city were not allowed in such case to contract for light for some reasonable period of time, and the individual or company furnishing light was compelled to trust for his compensation,'from year to year, to the varying moods of city councils, it is safe to say that no one would engage in such a hazardous enterprise. A city then must furnish its own’light, which is most frequently deemed inadvisable, at least in the smaller cities and towns, or remain in darkness.
This contract was for a period of twenty-five years, for which length of time the city had the express authority of law to execute it. Gen. Laws, 1877, subdivision 69, see. 2655.
No indebtedness was to accrue until after the company had commenced supplying gas, and what this would be for any given length of time it was impossible to determine in advance. If a prior appropriation was essential to the validity of the contract, then it could not have been executed at all, for the reason that it was impossible to compute the amount which would be due during the twenty-five years, even if it had the power to make such an appropriation for such a length of time or during any part of said time.
It is unreasonable to presume that the legislature required the performance of impossibilities, or that, having once expressly granted to a city the power of making such contracts as that in question, as it did in section 2655, it then in a succeeding section of the same act imposed such restrictions as to practically nullify such grant of power. Carlyle W. L. & P. Co. v. City of Carlyle, 32 Ill. App. 339.
We are clearly of the opinion that the provisions of section 2671 do not apply to contracts such as that in question in this suit, nor to such contemplated incurring of expense.
In construing a statute, reference must be had to the object to be attained and the means to be employed. It will not be *404presumed that the legislature attempted to authorize a proceeding unreasonable in itself. Neenan v. Smith, 50 Mo. 523; Sedg. Stat. & Const. Laws, 235.
“ The action of municipal corporations is to be held strictly within the limits prescribed by statute. Within these limits they are to be favored by the courts. Powers expressly granted or necessarily implied are not to be defeated or impaired by a stringent construction.” Kyle v. Malin, 8 Ind. 37; cited with approval in City of Pueblo v. Robinson, 12 Colo. 598.
Moreover, the sixty-ninth subdivision of section 2655 having expressly granted to cities and towns the power to enter into contracts such as the one in question, and to pay for the gas furnished “ such sum or sums as may be agreed upon between said contracting parties,” and the seventy-first subdivision of the same section having provided for a method of payment of such indebtedness by the levy and collection of a special tax, this character of contract would seem clearly to come within the exception of section 2671, “ except as herein otherwise expressly provided.”
The case of Smith Canal Co. v. Denver, 20 Colo. 86, turned upon the construction of a special provision of the special charter of the city of Denver, and did not involve an express contract, or any contract authorized by airy provision of the charter. It is not applicable to this case, especially as we hold that the contract in this case was within the exception of the statute. Neither is the case of Town of Durango v. Pennington, 8 Colo. 257. In that case the ordinance awarding the contract was held to be absolutely null and void, because, on its passage in the council, the yeas and nays were not called and recorded. There was no judicial construction of 'section 2671, and the facts of the case did not require it.
Holding, as we do, that no prior appropriation by the city was necessary or essential to the validity of the contract in question, it necessarily follows that the complaint of plaintiff was not defective by reason of a failure to allege it.
*405The second and main contention of defendant in error, in support of the demurrer, and which is urged by counsel with much force and ability, both in their brief and in oral argument, is that subdivision 71 of section 2655, supra, having provided a method of payment for indebtedness incurred under contracts, such as the one in question, by the levy and collection of a special tax, that method of payment is exclusive, that the plaintiff can look only to the fund arising from the collection of that tax for its payment, and that the city is liable only for a failure to levy or collect such special tax or to pay it to plaintiff when collected.
This is in substance and in its final result a claim that plaintiff has mistaken its remedy and can only proceed by mandamus to compel the city authorities to levy or collect the special tax, or, if collected, to pay it over to plaintiff.
As the issues are presented by the record in this case, it is not necessary for us to express an opinion as to whether or not the method of payment by special taxation referred to is exclusive. This question cannot possibly arise till after-judgment, if such is rendered, in favor of plaintiff.
The facts, as we gather them from the complaint, and hence admitted by the demurrer, are that the indebtedness sued upon is a matter of account for gas supplied during a period of years, and that the-account has never been audited or allowed by the city nor adjusted between the parties. The specific sum due does not and cannot, from the nature of the transaction, appear in the contract. This depends upon the varying number of street lamps which may have been furnished with gas during a given period of time, upon the amount, character and value of repairs, and also upon the partial payments which may have been made on account. All of these matters are open to dispute. The city may insist that the plaintiff has not supplied the gas to the number of lamps claimed, or that the repairs have not been of the character and extent charged for, or that the city has made payments for which it has received no credit. If this *406account had been audited or adjusted, and this proceeding was upon a warrant, as is true of the principal cases cited by counsel for defendant, or certificate or any record acknowledgment by the city of any specific sum due, an entirely different question would be presented. Certainly mandamus would not be the proper proceeding for the adjudication of such contested rights, or rights which may be contested, as arise upon the facts in this case. The primary object of mandamus is “to compel the performance of an act which the law specially enjoins as a duty resulting from an office, trust or station.” Code, 307.
Its proper function is merely to set in motion, to compel action and coerce the performance of a preexisting duty. High Ex. Legal Remedies, 7.
Before the writ can issue, “ it must appear in the petition therefor that the act which is to be enforced by the mandate is that which it is the plain legal duty of the respondent to perform, without discretion on his part either to do or to refuse.” Daniels v. Miller, 8 Colo. 553.
Even if it were conceded, as contended by defendant’s counsel, that the sole method of pajunent in this case is by special taxation, it must first be shown that some specific sum is due to plaintiff before mandamus would lie to compel the city to levy or collect the 'tax with which to make payment, or to pay if collection has been made. This can only be'adjudicated in some other proceeding, and the suit instituted by plaintiff is the proper one to determine this.
The question as to how the judgment, if one is obtained by plaintiff, shall be enforced is not before us.
These views expressed by this court are not in conflict with the opinion of the court in Smith Canal Co. v. Denver, 20 Colo. 86; nor in Forbes v. Board of Com. of Grand County, 23 Colo. 344; nor in Hockaday v. Board, 1 Colo. App. 362; all of which have been cited by counsel for defendant. The questions presented and decided in each of ■those cases are entirely different from those in this case, as we consider them.
*407The court erred in sustaining the demurrer to the amended complaint of plaintiff, and the judgment should be reversed and cause remanded.
Reversed.