delivered the opinion of the court.
This action was brought to. recover a small piece of land in the possession of the appellant, and as a judgment was recovered againt him for it, he had a right to appeal from the judgment, and this court has unquestionably jurisdiction over it. The objection therefore that the appeal does not lie, cannot prevail.
We deem the evidence sufficient to establish the fact, that the appellant obtained the possession of the land sued for, by some verbal contract of purchase with the appellee. The terms of the contract are not proved, nor does it appear that any purchase money Was paid. Still, as the appellant entered lawfully, his possession was not tortious, unless he had done some act to make it so, or unless a notice *73to quit, or a demand of possession had been made, and he had refused to surrender. There was no testimony to prove that his possession was unlawful at the time this action was commenced, and consequently the proof was insufficient to sustain it. (Harle vs. McCoy, 7 J. J. Marshall, 318.)
3. When the answer of the defendant to an ordinary petition set forth an equitable defense, the trial of the issue should be as in case of equitable proceedings; and if the equitable defense be adjudged insufficient, if there be a legal issue, that should be referred to, and tried by a jury, unless the jury be waived or some of the inodes pointed out by the Code.*73The appellant admitted in his answer that the legal title to the land was in the plaintiff; he did not however admit, but denied his right to the possession of it, and claimed the land as his own. It therefore devolved upon the plaintiff to prove every fact essential to his right of recovery.
The judgment is also objected to upon the ground that it was rendered by the court without the intervention of a jury. The defendant in the court below, ih his answer, not only denied the plaintiff’s right to the possession of the land, but alleged that he was himself the equitable owner of it, by purchase from the plaintiff, and had in good faith made upon it lasting and valuable improvements, believing the plaintiff would honestly execute his contract. He set up a claim for pay therefor, if he were compelled to give up the land, and asked for a lien thereon for the value of said improvements. The plaintiff denied that he had sold the land to the defendant, or that the latter had paid him anything for it.
The answer contained an equitable defense, and the issue made upon it was properly tried in the manner prescribed in cases of equitable proceedings. But as the action had been commenced by ordinary proceedings, and the defendant’s answer denied the plaintiff’s right to the possession of the land, an issue was thereby made between the parties, which was not cognizable in equity. When therefore the equitable defense was adjuged insufficient to defeat the plaintiff’s action the court should have referred the legal issue to the decision of a jury, unless a trial by jury was waived. The 10th section of the Code of Practice provides, that “where the action has been *74properly commenced by ordinary proceedings, either party shall have the right, by motion, to have any issue which, before the adoption of the Code, was exclusively cognizable in chancery,” tried as an equitable proceeding, and if all the issues were cognizable in chancery, though none were exclusively so, the defendant has a right to have them all tried as in cases of equitable proceedings. It is evident from this language that issues which are purely legal are to be tried, not as equitable issues, but as in cases of ordinary proceedings. Where the equitable defense is sufficient to defeat the plaintiff’s action, a trial of any legal issue in the case is of course unnecessary.
4. Issues of fact arising in actions by ordinary proceedings for the recovery of money or real or personal property are to be tried by a jury, unless a trial by jury is waived. (Code of Practice, sec. 342.) By an agreement to transfer a case to the equity docket, all the issues, whether legal or equitable, made in the case, are to be tried as equitable issues are tried — it is a waiver of a jury.Issues of fact, arising in actions by ordinary proceedings for the recovery of money, or of specific real or personal property, shall be tried by a jury, unless a jury trial is waived. (Code Practice, section 342.) The record does not contain any evidence that a trial by jury was waived in this case, by the defendant, in either of the modes prescribed by the Code, but it shows that the parties by consent transferred the case, and not merely the equitable issue, to the equity docket, and the defendant thereby, in our opinion, consented that the whole case should be tried as an equitable proceeding, and waived a trial by jury. As the testimony showed that the value of the improvements made by the defendant exceeded a reasonable rent for the premises during the time he had them in his possession, the court should have enforced the payment of the excess before rendering a final judgment for the plaintiff, even if the issue of fact, which, according to this opinion, should have been tried by a jury, if no consent had been given that it might be tided by the court, had been properly decided in his favor.
But inasmuch as the plaintiff failed to show that the defendant’s possession was unlawful, he was not entitled to a judgment, and his petition should have been dismissed. He will have the right however to bring another action for the recovery of the land, *75whenever the posssession of the defendant becomes tortious.
Wherefore, the judgment is reversed and cause remanded with directions to dismiss the plaintiff’s petition and render a judgment for the defendant.