
78 Ariz. 406 (1955)
281 P.2d 116
Albert E. FOSTER and Jane Doe Foster, his wife, Appellants,
v.
HOUSE BEAUTIFUL HOMES, Inc., a corporation, Appellee.
No. 5931.
Supreme Court of Arizona.
March 15, 1955.
Wesley E. Polley and John G. Pidgeon, Bisbee, for appellants.
Gentry & Gentry, and William E. Kimble, Bisbee, for appellee.
LA PRADE, Chief Justice.
Appeal from a summary judgment awarding plaintiff $2,500 plus costs for money due under a real estate brokerage contract. Defendant appeals, stating that the trial *407 court erroneously granted plaintiff's motion for summary judgment. He contends that the complaint failed to state a claim and that the pleadings and deposition disclosed genuine issues as to material facts.
Plaintiff, by way of a second assignment, became the owner of the contract sued on and the sums due thereunder. The original assignor, one Allford, a realtor, entered into a brokerage agreement with defendant by the terms of which Allford was to effect an exchange of defendant's California property for property located in Warren, Arizona. The contract acknowledged that Allford had secured the exchange and that there was due him by way of a commission fee the sum of $5,000, to be paid in two equal payments of $2,500 each. On nonpayment of the first installment this suit was instituted. The contract was by reference made a part of the complaint so that it affirmatively appeared that the consideration for the contract was personal services rendered as a real estate broker. The complaint did not allege that Allford, at the time his services were performed, was a duly licensed broker.
Defendant by his answer admitted the execution of the contract and nonpayment, and denied any liability thereunder. Defendant plead fraud on the part of Allford in inducing the contract with certain specifications not necessary to relate at this time. The answer contained the additional allegation that the complaint failed to state a claim upon which relief could be granted.
At the time the motion for summary judgment was considered there was before the court, in addition to the complaint and answer, the deposition of the defendant. It related chiefly to the services rendered and the asserted claims of fraud. It contained no reference as to whether Allford was a duly licensed broker. After considering the complaint, the answer and the deposition, the trial court determined that there were no genuine issues of fact on the fraud charges and accordingly rendered judgment for plaintiff.
By assignment of error defendant has challenged the correctness of the court's determination that there were no genuine issues of fact and that plaintiff was entitled to judgment as a matter of law. He points out that the complaint fails to allege that the broker was duly licensed. The applicable statute, section 67-1730, A.C.A. 1939, reads as follows:

"Actions for the collection of compensation.  An action for the collection of compensation earned may be maintained in the courts of the state, by any broker or salesman. To initiate any such suit the complaint must allege that the complainant was a duly licensed broker or salesman at the time the alleged cause of action arose, and precedent to hearing the cause the court shall require the plaintiff to prove the alleged qualifications of such licensee." Laws 1937, Ch. 53, sec. 30, p. 177.
*408 His proposition of law in support of the assignment that the complaint failed to state a claim is to the effect that in an action in the courts of this state for the collection of compensation by a real estate broker or salesman the complaint must allege that the complainant was a duly licensed broker or salesman at the time the alleged cause of action arose.
Appellee's position is that plaintiff waived the necessity of pleading license by his failure to affirmatively set forth in his answer any affirmative defense that he had by way of avoidance, and that the defense is unavailable when asserted for the first time on appeal. Appellee relies on Rule 8(c), Rules of Civ.Proc., being section 21-406, A.C.A. 1939. This rule reads:

"Affirmative defenses.  In pleading to a preceding pleading, a party shall set forth affirmatively accord and satisfaction, arbitration and award, assumption of risk, contributory negligence, discharge in bankruptcy, duress, estoppel, failure of consideration, fraud, illegality, laches, license, payment, release, res judicata, statute of frauds, statute of limitations, waiver, and any other matter constituting an avoidance or affirmative defense. When a party has mistakenly designated a defense as a counterclaim or a counterclaim as a defense, the court on terms, if justice so requires, shall treat the pleading as if there had been a proper designation." (Emphasis supplied.)
In a determination of these questions, attention must be given to rule 12(b), Rules of Civ.Proc., section 21-429, A.C.A. 1939, which reads:
"Defenses and objections  How presented  Motion to dismiss.  Every defense, in law or fact, to a claim for relief in any pleading, * * * shall be asserted in the responsive pleading thereto if one is required, except that the following defenses may at the option of the pleader be made by motion; * * * (6) failure to state a claim upon which relief can be granted. * * No defense or objection is waived by being joined with one (1) or more other defenses or objections in a responsive pleading or motion."
This rule specifically provides that every defense in law or fact, including the defense at law of failure to state a claim upon which relief can be granted, shall be asserted in the responsive pleading except that at the option of the pleader this particular defense may be made by motion. The pleader in the instant case did not choose, as was his privilege, to raise this defense by motion, but did assert it by setting forth this particular defense in the responsive pleading (answer). This defense at law that the complaint failed to state a claim created an issue at law which was undetermined and not capable of determination on the record before the court at the time the motion for summary judgment was filed and presented. This determination could have been resolved *409 at the trial of the issues created by the complaint and answer. A trial was precluded by the granting of the motion for summary judgment.
The answer that the complaint failed to state a claim upon which relief prayed for could be granted challenged the legal sufficiency of the facts alleged in the complaint. In view of the provisions of section 67-1730, supra, the complaint was insufficient in that it did not allege that the realtor was duly licensed at the time his services were performed. For this reason the judgment must be reversed.
The courts of California have taken a similar view in interpreting a comparable statute. See Silverberg v. Baum, 1928, 95 Cal. App. 535, 273 P. 47; Wilson v. Earp, 1928, 91 Cal. App. 538, 267 P. 112; Hayter v. Fulmor, 1944, 66 Cal. App.2d 554, 152 P.2d 746. An analogous situation is found in our case of Northern v. Elledge, 1951, 72 Ariz. 166, 232 P.2d 111, where the statute under consideration, section 67-814, A.C.A. 1939, provided that no building contractor could bring or maintain an action for his services without alleging and proving that he was duly licensed at the time the alleged cause of action arose. It was held that the contractor could not maintain an action where his license had expired and not renewed at the time the obligations were performed.
A summary judgment may be granted only when the undisputed facts warrant it. From this complaint there was missing the essential fact allegation  that plaintiff was duly licensed at the time the services were rendered.
In view of this determination it is unnecessary for us to consider the other assignments of error challenging the correctness of the court's finding that on the claimed issues of fraud there were no genuine issues of fact.
The judgment is reversed and the cause remanded for trial.
UDALL, WINDES, PHELPS and STRUCKMEYER, JJ., concur.
