The opinion of the court was delivered by
Smith, J.:This was an action for the payment of money. It was amended to make it, in addition, an action for specific performance. Judgment was for plaintiff. Defendant appeals.
The action was on a written contract referred to as an option to purchase. It was on a blank form in common use in Wyandotte county. Written into the form with a typewriter were the following words:
“In the event that Arthur Given received money on a judgment recovered by him against Midwest Paving Company, he agrees to pay the balance of the purchase price in cash less 5 per cent discount of said balance.”
The contract itself contained provisions that defendant should *507take possession of the property; that he should keep the buildings in repair and insured; that he should have the right to extend the option by the payment of $15 on the first day of May, 1930, and on or before the first day of each succeeding month; and that in event of the failure of defendant to make the payments or keep the buildings in repair or failing to pay the taxes thereon, defendant should have no right to occupy the property and plaintiff should be entitled to possession. There are other provisions in the contract not necessary to notice here. Suffice it to say that the same sort of contract was considered by this court in Marquez v. Cave, 134 Kan. 374, 5 P. 2d 1081. Defendants took possession of the property immediately after the contract was signed and lived on it for about two years and a half. During this time they paid about $41 in cash and $25 in labor. They paid no taxes. When plaintiff learned that defendant had collected his judgment from the Midwest Paving Company and had not paid the balance on the contract he brought this action. The action was started to recover the $1,300.50 due on the contract. At the trial the court suggested that the petition be amended and specific performance be asked for. The petition alleged facts about as have been detailed here. The answter was in effect a general denial. Defendants denied that they had elected to purchase the property in question, but alleged that they had elected not to purchase it. Trial was by the court. Findings were made that the contract was one for the purchase and sale of real property and not an option; and that plaintiff was entitled to specific performance.
Defendant raised by appropriate motions and argues here that the judgment was erroneous for the following reasons: that the judgment and decree are contrary to the provisions of R. S. 1933 Supp. 79-3107; that the plaintiff failed to establish equities entitling him to the relief sought and that the trial court erred in holding the contract to be one of purchase and sale rather than an option.
The latter question has been settled by this court in the case of Marquez v. Cave, supra. Little can be added to what Was said there. The contract is clearly an attempt to so confuse the language used in an instrument that it will appear to be something other than what it is. If anything further were needed to fortify this holding, the language that was written into the contract with a typewriter, and which has been heretofore set out in this opinion, supplies it. *508This court will examine the surrounding circumstances and apparent intent of the parties when construing an instrument rather than to be.guided solely by the name given it. This instrument is clearly a written contract for the sale of real estate.
Defendant argues here that the judgment is wrong because plaintiff had not complied with the provisions of R. S. 1933 Supp. 79-3107. That section is as follows:
“Any mortgage of real property executed on or after March 1, 1925, on which the registration fee as herein provided has not been paid, shall not be filed for record by any register of deeds, and such mortgage shall not be received in evidence in any suit, action or proceeding, and no judgment, decree or order for the enforcement thereof shall be rendered, made or entered in or by any court in this state.”
Another section of the same chapter, being R. S. 1933 Supp. 79-3101, defines what is meant by the word mortgage. It is as follows:
“. . . An executory contract for the sale of real estate, or a bond for a deed, the complete performance of which is deferred for a longer period than ninety days from its execution, under which the grantee or vendee is entitled to the possession of such real estate, by the terms of which the grantor holds the legal title as security for the unpaid purchase money, shall for the purpose of this act be treated as a mortgage of real property to secure the balance of the unpaid purchase price.”
It will be seen from what has already been said in this opinion that the instrument sued on is a mortgage as defined in this act. Since that is the case, the plantiff is asking the court to enforce a contract for him when the statutes provide that the contract is without any force whatever. The statute is plain. It says no instrument upon which the registration fee has not been paid can be the basis of a judgment. In other words, one who owns a mortgage cannot refuse to pay taxes to support the courts, and then resort to the courts to collect his mortgage. This subject was considered in Sheldon v. Pruessner, 52 Kan. 579, 35 Pac. 201. There the holder of a mortgage had transferred it to his father who resided outside the state to-escape paying taxes on it. The father brought suit to collect under the mortgage. Without the aid of a statute, such as we have in this case, this court held that the father could not collect. The court said:
“Whatever tends to interfere with the beneficial operation of the statute is unlawful, as against the policy of the law. Whatever tends to obstruct duty by defeating the letter or spirit of the law is also unlawful, and the courts will not enforce any agreement or contract for the benefit of one through whose direction or assistance the law is violated, or public policy contravened. The *509law attempts to close the doors to temptations by refusing such parties recognition in the courts.” (p. 590.)
In Wheeler v. Weightman, 96 Kan. 50, 149 Pac. 977, this court held a mortgage-registration act to be unconstitutional, but in the opinion the court considered section 6 of the act, which contains the same provisions as the section we are considering. The court said:
“Apart from and independent of any privilege to record, the mortgagee must pay the tax on his mortgage to prevent its emasculation. Consequently the registration fee is not the mere price of the privilege to register, but is a compulsory exaction levied for revenue purposes directly upon the mortgage as such, which loses its quality of evidence and security unless the tax be paid.” (p. 77.)
To the same effect are Greenwood v. Price, (Okla.) 27 P. 2d 822; Mutual Life Ins. Co. v. Nicholas, 128 N. Y. Supp. 902; Orr v. Sutton, 119 Minn. 193, 237 N. W. 973.
The answer of plaintiff to this argument in the brief is, first that the defense of failure to pay the registration is not pleaded. The fact that a contract violates the law does not need to be pleaded. It is the duty of the court to act on it whenever it is brought to its attention. (See Sheldon v. Pruessner, supra; also, Sage v. Oil Country Specialties Mfg. Co., 138 Kan. 501, 27 P. 2d 542.) In that case the court held as follows:
“Where an action has been brought on a contract, and during the course of the trial it becomes apparent that the contract sued on is in violation of law, it is the duty of the trial court to dismiss the action regardless of whether the illegality of the contract was raised by the pleadings.” (Syl. ¶ 5.)
Plaintiff argues that this defense is not available to defendant because it does not appear affirmatively from the record that the tax was not paid. The answer to this is twofold — first, since we have seen that the payment of the registration tax is an essential to recovery of a judgment on the instrument it was incumbent upon plaintiff to plead and prove such payment. It was not the duty of defendant to show that the tax had not been paid, but was the duty of the plaintiff to show that it had been paid; second, undoubtedly the instrument in question was offered in evidence. R. S. 1933 Supp. 79-3104 provides that when the registration fee is paid the register of deeds shall indorse the payment on that instrument. Had the instrument in question borne such an indorsement no doubt plaintiff would have called it to our attention. The force of this argument is weakened also by the contention of plaintiff that this instrument *510is not the kind of an instrument that could be registered. There' can be no doubt in this case that the registration fee was not paid.
We therefore have concluded that the instrument sued on was the kind of an instrument that is covered by R. S. 1933 Supp. 79-3107; that the plaintiff had not complied with that section, and that consequently no judgment can be based upon it.
The judgment of the trial court is therefore reversed with.directions to enter judgment for the defendant.