Appellant was hired by the governing board of Pima Junior College in early 1968, for the fiscal year of 1968 through 1969, for the position of dean of administration of Pima Junior College. He was rehired by the board for the fiscal year 1969 through 1970. The board also gave its tentative commitment for the fiscal year 1970 through 1971. While no written contracts were issued to appellant, he was given an annual salary of $20,000 and a $2,000 car allowance for the 1969 through 1970 fiscal year.
Appellant performed his duties without incident until September 16, 1969, at which time he received a letter from the Provost of Pima Junior College requesting him to submit his resignation. Appellant did not resign and did not leave the junior college until he was locked out of his office and his salary stopped.
On November 4, 1969, appellant filed a petition for writ of mandamus against appellees wherein he asked the court for the following relief: That the appellees be directed to reinstate him as dean of administration of Pima Junior College for the balance of the fiscal year of 1969 through 1970; that the board be directed to recog*154nize the existence of petitioner’s contract for the fiscal year 1970 through 1971; that the appellees be directed to issue a written statement of reasons for dismissal for the fiscal year 1970 through 1971 and upon timely demand give the appellant a hearing on such dismissal; that the appellees be directed to forthwith grant a written contract to the appellant covering the partially elapsed fiscal year of 1969 through 1970.
Appellant’s petition was dismissed by the trial court and that dismissal was affirmed by this court in Kaufman v. Pima Junior College Governing Board, 14 Ariz.App. 475, 484 P.2d 244 (1971). Subsequent to the dismissal of the petition for mandamus and prior to our decision on the appeal thereof appellant filed a complaint for damages in Superior Court and requested the following relief:
“1. Ordering defendants to allow plaintiff the opportunity to perform his employment contract;
2. Ordering defendants to provide a proper hearing and other procedures provided in continuing contract law to the plaintiff, as concerns his employment or proposed termination by the defendants ;
3. For a contribution by the defendants to the state educational retirement fund for the benefit of plaintiff in an amount as determined by the Court;
4. That proper credit toward vestiture of the retirement fund be given plaintiff by inclusion of such a provision in the herein judgment;
5. For that amount as found by the Court to be due and owing by the defendants to plaintiff as concerns his employment contract;
6. For approximately $2,000 expended by plaintiff as and for medical attention;
7. For plaintiff’s costs of suit incurred herein; and
8. For such other and further relief as to the Court seems just and proper in the premises.”
Appellee Pima Junior College moved to' dismiss the complaint for the reason that the dismissal of appellant’s petition for'-a writ of mandamus in cause No. 116222' constituted res judicata. Following. the lower court’s granting of defendants’ Motion to Dismiss plaintiff brought this appeal urging that the trial court erred in two respects: (1) That the dismissal of the mandamus action was not, as a matter of law, res judicata as to the subsequent action for damages and (2) that even if the prior action could have constituted res judicata, defendants failed to meet the burden of proving such. We will first consider the latter argument.
In Lakin Cattle Co. v. Engelthaler, 101 Ariz. 282, 419 P.2d 66 (1966), our Supreme Court recognized the defense of res judicata as an affirmative defense which must be both plead and proved by the defendant. In adopting the rule set forth by the Colorado Supreme Court, the court quoted from Ruth v. Department of Highways, 153 Colo. 226, 385 P.2d 410 (1963) :
“ ‘To sustain the defense, facts in support of it must be affirmatively shown either by the evidence adduced at the trial, or by way of uncontroverted facts properly presented in a motion for summary judgment or by a motion to dismiss under Rule 12(b), R.C.P.Colo., where the court, on the basis of facts properly presented outside of the pleadings, is enabled to treat the same as a motion for summary judgment under Rule 56.’ ” 101 Ariz. 284-285, 419 P.2d 68-69.
In Finger v. Beaman, 14 Ariz.App. 18, 480 P.2d 41 (1971), the court reversed a dismissal based on res judicata because the record did not expressly show that the trial judge had taken judicial notice of the prior action, even though a certified copy of the judgment had been attached to defendants’ motion to dismiss.
In the case sub judice the record is devoid of any evidence that the trial judge took judicial notice of the judgment m cause No. 116222. Furthermore, there is *155nothing in the record before us to support a finding that the dismissal of cause No. 116222 was based upon the merits. As defendants failed to prove res judicata we cannot sustain the dismissal by the trial •court.
Appellant further contends that the suit for mandamus cannot, as a matter of law, bar the subsequent suit for damages. Our Supreme Court in Rousselle v. Jewett, 101 Ariz. 510, 421 P.2d 529 (1966) set forth the following test for a determination of res judicata:
“For a prior suit to be res judicata, the same issues must be decided therein which were raised in the second cause. Only such matters are adjudicated in a former judgment which appear upon its face to have been adjudicated or which were actually and necessarily included therein or necessary thereto. Rights, claims, or demands — even though they grow out of the same subject matter —which constitute separate or distinct causes of action not appearing in the former litigation, are not barred in the latter action because of res judicata.” 101 Ariz at 512, 421 P.2d at 531.
Appellant’s original action, cause No. 116222, was a petition for a writ of mandamus brought pursuant to A.R.S. § 12-2021 et seq. Such an action can be maintained only “to compel, when there is not a plain, adequate and speedy remedy at law, performance of an act which the law specially imposes as a duty resulting from an office . . . .” A.R.S. § 12-2021; Rhodes v. Clark, 92 Ariz. 31, 373 P.2d 348 (1962). Thus it is clear that the relief sought by appellant in cause No. 119904 could not have been obtained by means of a petition for a writ of mandamus. While the record before us does not contain the judgment in cause No. 116222, we can, of course, take judicial notice of our own opinion in that case on appeal. In Kaufman v. Pima Junior College Governing Board, supra, we upheld the dismissal of the petition for a writ of mandamus because appellant had not previously exhausted his administrative remedies.
While we do not question that final judgment rendered on the merits of an application for a writ of mandamus may constitute the basis for a plea of res judicata, the rule has no application where the applicant has misconceived his remedy or where he later presents a claim which constitutes a separate or distinct cause of action. Rousselle v. Jewett, supra. As was stated in Hoffman v. Silverthorn, 137 Mich. 60, 100 N.W. 183, 185 (1904) and Warren v. Stanton County, 145 Neb. 220, 15 N.W.2d 757, 762 (1944):
“It does not follow, because the mandamus was denied, that the court passed upon the merits of plaintiff’s application. That mandamus may have been denied because no case was made that appealed to the discretionary power of the court, because relator had a manifest legal remedy of which he could not be deprived, or because mandamus was not the proper remedy. If the mandamus was denied for either of these reasons, no authority need be cited to the proposition that that decision was not res judicata.”
We are of the opinion that appellant’s claim in the case sub judice is a separate and distinct cause of action within the meaning of Rousselle v. Jewett, supra, and that the decision against appellant in the mandamus action was not on the merits. Our decision in Kaufman v. Pima Junior College Governing Board, supra, does serve however, to bar further litigation on the question of whether appellant was covered by the Arizona Teachers Tenure Act. We therefore hold that the dismissal of appellant’s petition for a writ of mandamus does not, as a matter of law, constitute a bar to the present action on the basis of res judicata.
Reversed and remanded for further proceedings not inconsistent with this opinion.
HATHAWAY and HAIRE, JJ., concur.