
564 P.2d 1326 (1977)
90 N.M. 444
The CITY OF SANTA FE, a Municipal Corporation organized under the laws of the State of New Mexico, Plaintiff-Appellee,
v.
Jose Benito VELARDE et al., Defendants-Appellants.
The CITY OF SANTA FE, A Municipal Corporation organized under the laws of the State of New Mexico, Plaintiff-Appellee,
v.
Ray Victor ARMIJO et al., and Jose Benito Velarde, Defendants-Appellants.
Nos. 11084 and 11091.
Supreme Court of New Mexico.
May 23, 1977.
Rehearing Denied June 8, 1977.
William W. Gilbert, Santa Fe, for defendants-appellants.
*1327 Bob D. Barberousse, City Atty., Harry S. Connelly, Jr., Sp. Asst. City Atty., Santa Fe, for plaintiff-appellee.

OPINION
MAURICE SANCHEZ, District Judge.
In November, 1973, the City of Santa Fe (City), in its corporate and proprietary capacities, brought suit in the district court of Santa Fe County to quiet title to certain property. The complaint named Jose Benito Velarde (Velarde) and several others as party defendants.
Velarde answered, pleading laches, limitations concerning lands granted by the United States, adverse possession for a period of ten years under color of title with payment of taxes and a general denial. Following Velarde's answer, the City moved for summary judgment against him upon the alternative grounds "that Santa Fe County Cause No. 46215 is res judicata upon all issues in this case or that Santa Fe County Cause No. 46215 collaterally estops the Defendant Jose Benito Velarde from defending this action."
Cause No. 46215 on the docket of the Santa Fe County District Court (first case) was an action previously filed by Velarde and his wife, claiming to be the owners in fee simple and in actual possession of certain described lands, which lands for all practical purposes are the same as the land involved in the suits to quiet title which are the subject matter of this appeal. It appears that in the first case Velarde had sought a quitclaim deed to the lands in question from the City of Santa Fe under a patent issued by the United States of America to the City on February 16, 1901, pursuant to the act of Congress approved on April 9, 1900, entitled "an Act to settle the Title to Real Estate in the City of Santa Fe, New Mexico." Under the Act, the City was granted the land "in Trust for the benefit of all persons claiming title to their individual holdings of real estate ... by actual possession or under color of title for the period of ten years prior to the passage" of the legislation and further ordered "to execute proper deeds of quitclaim to the persons entitled thereto." Velarde's application for such a deed apparently having been previously turned down without a hearing, he alleged in the first case among other things that the Act and the city ordinance implementing it did not provide for an adequate opportunity to be heard, were subject to unequal enforcement, and thus should be declared unconstitutional. The suit further alleged that the City had a conflict of interest with respect to appellant inasmuch as the land was being claimed by the City both in its proprietary and fiduciary capacities, and that the Mayor, Clerk, and other City agents had refused appellant's application for a quitclaim deed without properly processing it. The City filed a motion to dismiss challenging (1) the court's jurisdiction, (2) plaintiffs' capacity to sue, (3) the sufficiency of the claim stated as a subject for relief, (4) the lack of an (unnamed) indispensable party, and (5) the claim that plaintiffs were taking fatally inconsistent positions in the same case. The district court entered an order dismissing the complaint with prejudice unless Velarde, within twenty days, amended his complaint to seek mandamus or quiet title or both. The order specifically recited that by stipulation of the parties "the Complaint on file herein does not assert on behalf of plaintiffs a Quiet Title action against the Defendant... ." Velarde did not avail himself of the leave to amend and the first case stood dismissed.
This appeal is taken from the district court's order granting the City's motion for summary judgment on the grounds of res judicata and collateral estoppel predicated upon the order dismissing the first case with prejudice. The cases are docketed as Nos. 11084 and 11091 on the docket of this court and the legal issues in both cases being identical in all respects, the court has considered them together.
The doctrines of res judicata and collateral estoppel by judgment involve different and distinct principles. Res judicata in its proper application operates where there are identical parties, causes of action, *1328 subject matter, and capacities in the two cases; collateral estoppel by judgment arises where the causes of action are different but some ultimate facts or issues may necessarily have been decided in the previous case. Stated another way, where the causes of action in the cases are identical in all respects, the first judgment is a conclusive bar upon the parties and their privies as to every issue which either was or properly could have been litigated in the previous case. But absent the identity of causes of action, the parties are precluded from relitigating only those ultimate issues and facts shown to have been actually and necessarily determined in the previous litigation. Atencio v. Vigil, 86 N.M. 181, 521 P.2d 646 (1974); Miller v. Miller, 83 N.M. 230, 490 P.2d 672 (1971); Curtis Manufacturing Company v. Barela, 76 N.M. 392, 415 P.2d 361 (1966); Terry v. Pipkin, 66 N.M. 4, 340 P.2d 840 (1959); Williams v. Miller, 58 N.M. 472, 272 P.2d 676 (1954); McCarthy v. Kay, 52 N.M. 5, 189 P.2d 450 (1947); Paulos v. Janetakos, 46 N.M. 390, 129 P.2d 636 (1942); Flint v. Kimbrough, 45 N.M. 342, 115 P.2d 84.
In Paulos, supra, we reviewed the many cases on the subject and then said:
As this action and the equity suit have identical parties, but are brought upon different claims or demands, the judgment in the latter operates as an estoppel only as to the questions, points, or matters of fact in issue in that case which were essential to a decision, and upon the determination of which the judgment was rendered. (Citations omitted.)
46 N.M. at 393, 129 P.2d at 637.
The City argues that the "causes", "rights asserted by appellant", and "issues" in the previous and the present case are "the same" and in support of its argument points to the following facts none of which are disputed: (1) the first and second cases involve some or all of the same land; (2) appellant was plaintiff in the first case and defendant in the present case; (3) appellant had counsel in both cases; (4) in the first case appellant was given the opportunity to amend his pleadings seeking mandamus or quiet title and chose not to do so; (5) appellant had a right to appeal the dismissal of the first case and did not do so, and (6) the dismissal of the first case was "with prejudice."
Admittedly, all of the propositions asserted are true. None of these propositions, however, or any combination thereof meet the test for the application of the doctrines of res judicata or collateral estoppel by judgment under the rules enunciated in Paulos v. Janetakos, supra, and the other cases cited.
In our view, the fact that Velarde was given the opportunity to amend his pleadings so as to change his cause of action is not the same as to say that the causes of action were identical. The rule that a prior final decision determines not only what was in issue but also what might have been put in issue contemplates existing identical causes of action and not what the causes of action might have been after theoretical amendments to the pleadings which in fact were never made. The case of Gilman v. Osborn, 78 N.M. 498, 433 P.2d 83 (1967), cited by the City, involved identical causes of action and, therefore, is not in point.
The causes are reversed and remanded to the trial court with instructions to overrule the motion for summary judgment and to proceed accordingly.
IT IS SO ORDERED.
EASLEY and PAYNE, JJ., concur.
