The opinion of the court was delivered by
McElroy, J.:This action whs brought by Freeman, plaintiff in error, against the board of county commissioners of Wyandotte county, for services rendered by plaintiff in error as an attorney and counselor at law. A trial was had before the court and a jury. The plaintiff introduced his evidence and rested, and the defendant board of county commissioners interposed a demurrer to the evidence, which was sustained, the plaintiff excepting. A motion for a new trial was filed and overruled, and the-case is presented to this court for review.
It appears from the record that J. J. Squires com*73menced an action in ejectment in the circuit court of the United States for the district of Kansas against Quindaro township, in Wyandotte county, C. F. Horstman, trustee, Frank Brown, clerk, and D. Braman, treasurer, of such township, to recover the title and possession of Quindaro park. The board of county commissioners employed Freeman as attorney and counselor at law to defend the suit, and he performed the. services. The board of county commissioners paid the expenses of Freeman incident to the action. Freeman presented his bill for $1500, payment of which was rejected by the board. He appealed to the district court, where judgment was rendered on the demurrer as before stated. Quindaro park, the subject of the litigation in the action in which the professional services were rendered, was dedicated to the public, the fee of the park, however, being in Wyandotte county. The action of Squires was defeated, and this proceeding was brought to recover compensation for such services. The Squires case is reported as Quindaro Township v. Squires, 51 Fed. 153.
The defendant in error, in the trial court and here, contends that the suit of Squires against Quindaro township in the circuit court was one in which Quindaro township and its officers alone were interested ; that the action involved a township matter and not a matter in which the county had any interest; that inasmuch as neither the board of county commissioners nor any of the county officers were parties to the action in the United States circuit court, the board of county commissioners' had no right or power to employ counsel in such suit, and that the board of county commissioners in employing such counsel acted without authority, and such contract is void.
The only question in this case is whether the county *74commissioners had the power and authority to employ the plaintiff in error to defend such suit at the expense of Wyandotte county. In the case of Squires against Quindaro township, the subject-matter of the litigation was Quindaro park. • This park was dedicated to the use of the public, the legal title being vested in Wyandotte county. In Thacher & Stephens v. Comm’rs of Jefferson Co., 13 Kan. 182, the court said:
“In many cases the county is bylaw constituted the general agent or guardian for the protection of the rights and interests of townships, and of other subdivisions of the county, and may prosecute or defend therefor. Thus, the county, through the board of county commissioners, may maintain an action against the county treasurer for a misappropriation or misapplication of the funds of a township or school district, etc., although the county as a corporation can have but little interest in the funds of such township or school district. (Comm’rs of Jackson Co. v. Craft, 6 Kan. 145.) . . . We suppose that whenever the county is interested at all in the result of a suit, either in its own behalf or in that of some township of the county, and the suit is brought against the legal representatives of the county, and is beyond the limits of the county, the county commissioners may, if they choose, employ counsel to take care of the interest of the county.”
The plea of ultra vires, as a general rule, will not prevail when it will not advance justice but will on the contrary accomplish a legal wrong. It is very well settled that a corporation cannot avail itself of the defense of ultra vires when the contract has been in good faith performed by the other party and the corporation has had full benefit of the performance of ths contract. We are of the opinion that the county has such an interest in its townships as will enable the county commissioners to assist them in defending *75their rights, and that Wyandotte county has such an interest in Quindaro park and township as to enable the county commissioners to make a legal contract for the services of Freeman in defending the action of Squires, and that the contract so made with Freeman fixed a legal liability on the county to pay the reasonable value of such services rendered. The court ■erred in sustaining the demurrer.
The judgment will be reversed, .and the cause remanded with direction that the trial court overrule the demurrer and grant a new trial.