Plaintiff in error, hereinafter called plaintiff, commenced this action against defendant in error, hereinafter *Page 313 called defendant, by filing his petition in the district court of Wagoner county, wherein he alleges that he was the owner of 40 acres of land lying in that county, and that he was entitled to possession thereof, but that defendant was in possession of said land wrongfully and unlawfully, claiming to hold the same by virtue of a certain lease, which plaintiff alleges was procured by fraud and is void. He further alleges that defendant is insolvent and owns no property subject to execution, and prays for appointment of a receiver to collect the rents and profits of the land pending the determination of the title and right of possession, and also prays for cancellation of the lease under which he alleges defendant claims possession of the property. Defendant, by answer and supplemental answer, admits that he holds a lease on said property which was executed on the 12th day of December, 1907, by the then owner of the land in controversy for a period of five years; and he denies that said lease was fraudulently obtained, or that the same is void. He further alleges that since the institution of this action plaintiff has taken possession of the land in controversy, and now wrongfully and unlawfully withholds possession of same from defendant, and has for a period of one year received the rents and profits on said land to defendant's damage; and he prays that plaintiff take nothing by his petition, and that he have judgment against plaintiff for quiet and peaceable possession of the land, and for the rents and profits. Before the action came on for trial plaintiff dismissed his petition, and the cause thereafter proceeded to trial upon defendant's answer and cross-petition, and resulted in a judgment for defendant for possession, and for the sum of $160 for rents and profits.
Plaintiff challenges in this court for the first time the jurisdiction of the trial court to render judgment upon defendant's counterclaim or cross-petition. In support of his contention, he argues that defendant's cross-petition sets up a cause of action for forcible entry and detainer, of which courts of justices of the peace have exclusive original jurisdiction, *Page 314 and that the judgment for damages is less than the minimum jurisdiction of the district courts. These contentions are without merit. Defendant's answer and cross-petition do not set up a cause of action for forcible entry and detainer. It is not alleged that plaintiff is holding over his term; nor is it alleged either that he obtained or retains possession by force. All that is alleged in the answer is that plaintiff is unlawfully in possession of the land in which defendant owns such a leasehold estate as entitles defendant to possession, and that plaintiff continues unlawfully to withhold such possession from defendant. This states only a cause of action in ejectment.
Under the Code, an action of ejectment lies to recover lands held under a lease for a term of years. Hurst v. Sawyer,2 Okla. 470, 37 P. 817. Where the holder of the lease attempts to recover possession by such action, he founds his recovery or right of possession upon an interest in the land arising from ownership of the lease upon the land. Of such action courts of justices of the peace have no jurisdiction. Zahn v. Obert,24 Okla. 159, 103 P. 702.
Under the Code, a defendant may set forth in his answer as many grounds of defense, counterclaims, set-offs and for relief as he may have, whether such as have heretofore been denominated legal or equitable or both. Section 5634, Comp. Laws 1909 (Rev. Laws 1910, sec. 4745). By section 5635, Comp Laws 1909 (Rev. Laws 1910, sec. 4746), it is provided that the counterclaims mentioned in the preceding section shall arise out of the contract or transaction set forth in the petition of plaintiff as the foundation of plaintiff's claim, or be connected with the subject of the action. The subject of the action in the case at bar is the possession of the land described in plaintiff's petition and the lease contract under which defendant claims his right to possession, for plaintiff prays for a cancellation of the latter. Defendant in his cross-petition asks judgment for the possession of the same land, and for a decree declaring his lease contract valid. *Page 315 These allegations appear to us to bring it clearly within the statute authorizing defendant to obtain relief by his cross-petition; and this conclusion is supported by Venable v.Dutch, 37 Kan. 515, 15 P. 520, 1 Am. St. Rep. 260.
A plaintiff may, upon the payment of costs, dismiss any civil action at any time before petition of intervention or answer praying for affirmative relief is filed, and after such intervention or answer praying for affirmative relief is filed he may dismiss his action; but such dismissal shall not prejudice the rights of intervener or defendant to proceed with the action. Sections 5919, 5920, Comp. Laws 1909 (Rev. Laws 1910, secs. 5126, 5127). And in his action to recover the real estate he may join his cause of action for rents and profits on such real estate. Section 5623, Comp. Laws 1909 (Rev. Laws 1910, sec. 4738); Seibert v. Baxter, 36 Kan. 189, 12 P. 934;Gatton v. Tolley, 22 Kan. 678.
We do not undertake to decide whether if the cause of action alleged in defendant's cross-petition had been one of forcible entry and detainer the court would have had jurisdiction to prosecute same after the dismissal of plaintiff's petition; for a decision of this question is not necessary, because the cause of action set up in the cross-petition for affirmative relief is one of which the district court has jurisdiction, and for the reasons already suggested the judgment of the trial court must be affirmed.
All the Justices concur. *Page 316