
179 Ariz. 428 (1993)
880 P.2d 648
COLONIAL TRI-CITY LIMITED PARTNERSHIP, an Arizona partnership, Plaintiff-Appellee,
v.
BEN FRANKLIN STORES, INC., a Delaware corporation, Defendant-Appellant.
Nos. 1 CA-CV 91-108, 1 CA-CV 92-006.
Court of Appeals of Arizona, Division 1, Department A.
December 16, 1993.
Review Denied September 20, 1994.
*429 Murphy & Associates by Joseph A. Herbert and Michael L. Murphy, Phoenix, for plaintiff-appellee.
Broening, Osberg & Woods by Terrence P. Woods, Donald Wilson, Jr., Kenneth C. Miller and Neal B. Thomas, Phoenix, for defendant-appellant.
OPINION
MICHAEL J. O'MELIA, Judge[*].
This case requires us to decide whether a plaintiff may use the summary proceeding *430 for recovery of possession of leased premises, Ariz. Rev. Stat. Ann. ("A.R.S.") section 33-361 (1990), to litigate whether, in the first instance, the parties have created a landlord and tenant relationship. We hold that plaintiff was not entitled to use the section 33-361 summary proceedings to establish that defendant exercised its option to reassume a lease previously assigned to defendant's franchisee. Consequently, because defendant established that plaintiff and defendant did not have an existing landlord and tenant relationship when the section 33-361 action was filed, the trial court erred by not dismissing the action. Because our decision disposes of this appeal, we do not address defendant's remaining arguments.
FACTS AND PROCEDURE
On June 19, 1989, Colonial Tri-City Limited Partnership ("plaintiff") leased to Ben Franklin Stores, Inc. ("defendant") certain retail space located in Tri-City Mall for a term of ten years. Paragraph 26 of the lease contains an assignment clause and a reassumption clause. Under paragraph 26, defendant, with plaintiff's prior written consent, may assign all its rights and obligations under the lease to a franchisee. From the effective date of any such assignment, defendant "shall be relieved of all liability and/or responsibility under [the] lease." If a franchisee later terminates the franchise, defendant can reassume the lease "by paying all amounts past due ... and [by serving] written notice upon [plaintiff]." The effective date of any such reassumption is the effective date of termination of the franchise.
Plaintiff, defendant, and Dub & Sal's, Inc. ("Dub & Sal's") later executed an agreement entitled First Assignment and Assumption of Lease and Landlord's Consent. In this agreement, defendant, with plaintiff's consent, assigned all defendant's rights and obligations under the lease to Dub and Sal's. The agreement further provided that Dub & Sal's "assumes the Lease and agrees to pay rent and all other payments required ... and to faithfully perform all of the covenants, stipulations and agreements contained therein and ... agrees to hold [defendant] harmless therefrom." Dub & Sal's took possession of and operated a store in the leased premises until roughly May 25, 1990, when they vacated the premises.
Some time in the latter part of May 1990, Tri-City Mall security personnel observed that Dub & Sal's had ceased operations and that "closed for inventory" signs were posted in the windows of the vacant store. The security personnel also saw defendant's employees removing the remaining inventory from the store. After learning of defendant's presence on the premises, plaintiff notified defendant by letter that defendant was in default under the June 19, 1989 lease. The letter requested that defendant cure this default by promptly paying all overdue rent and charges. In its reply, defendant denied it owed back rent and claimed that it had "no current interest in that certain lease dated June 19, 1989," because it had assigned its entire interest to Dub & Sal's on August 15, 1989.
On June 26, 1990, plaintiff filed an action under A.R.S. section 33-361(A) (1990) (as governed by the summary forcible entry and detainer statute, sections 12-1171 through 12-1183 (1982 and Supp. 1992)) in Maricopa County Superior Court No. 90-17669. The complaint did not allege that defendant reassumed the June 1989 lease or otherwise reestablished a landlord and tenant relationship with plaintiff following the assignment to Dub & Sal's. Plaintiff alleged only that defendant had no right of possession of the premises because defendant failed to cure its breach of the lease by paying the overdue rent and other charges. In its prayer for relief, plaintiff sought immediate possession of the premises and all unpaid rent since June of 1990.
Defendant filed a motion to dismiss pursuant to Rule 12(b)(6), Arizona Rules of Civil Procedure, contending that plaintiff failed to state a claim for relief. Defendant argued that by completely assigning its rights and obligations under the June 1989 lease to Dub & Sal's, defendant and plaintiff were no longer landlord and tenant, and thus plaintiff's section 33-361 action was precluded. Defendant *431 also argued that the trial court lacked jurisdiction under the forcible entry and detainer statute to hear the action because defendant had no possessory interest in the premises. Finally, defendant argued that the trial court was deprived of jurisdiction by plaintiff's failure to make a written demand for possession of the premises, pursuant to A.R.S. section 12-1171(3) (1982). The trial court, however, denied defendant's motion to dismiss and commenced a trial by jury later that same day.
At the close of plaintiff's case, defendant moved for a directed verdict, which the trial court denied. The jury found that defendant (1) reassumed the lease on May 25, 1990, (2) failed to pay rent owed to plaintiff, and (3) committed a forcible entry and detainer. The jury awarded plaintiff immediate possession of the premises and $18,820.66 in unpaid rent. The court entered judgment consistent with the jury's verdict on August 30, 1990.
Defendant challenged the jury's verdict with a motion for judgment notwithstanding the verdict. Defendant argued that the trial court lacked jurisdiction to litigate the case because plaintiff's right of possession was not at issue. The trial court denied the motion and defendant appealed.[2]
Following plaintiff's summary proceeding, plaintiff filed a general civil action for breach of lease against defendant on January 15, 1991, in Maricopa County Superior Court No. CV 90-25424. The complaint alleged that defendant reassumed the June 1989 lease on May 25, 1990, and later breached the lease by failing to pay rent from August 1990, through November 1990. The trial court found that because plaintiff obtained a judgment against defendant in the section 33-361 summary proceeding, defendant's defenses in CV 90-25424 were precluded under the doctrines of res judicata and collateral estoppel. Consequently, the court granted plaintiff's motion for summary judgment in CV 90-25424 and entered judgment for plaintiff for $85,822.54 in unpaid rent. On October 17, 1991, defendant appealed. We consolidated defendant's appeals by order dated January 10, 1992.
ANALYSIS
We hold that a plaintiff may not maintain an action under section 33-361 where a defendant establishes that the parties do not have an existing landlord and tenant relationship. Here, we conclude that plaintiff did not establish that defendant reassumed the lease previously assigned to defendant's franchisee. Consequently, the trial court erred by not dismissing the section 33-361 action. We therefore reverse the judgment in the summary proceedings (cause No. 90-17669), vacate the judgment in the civil action (cause No. 90-25424), and remand for a new trial in the latter action.
We begin by considering defendant's motion to dismiss the section 33-361 summary proceeding. On a motion to dismiss for failure to state a claim under Rule 12(b)(6), Arizona Rules of Civil Procedure,[3] if the trial court considers matters presented outside the complaint, the motion is regarded as one for summary judgment, provided all parties are given a reasonable opportunity to present their factual claims to the court. Parks v. Macro-Dynamics, Inc., 121 Ariz. 517, 519-20, 591 P.2d 1005, 1007-08 (App. 1979). Here, defendant's motion to dismiss complied with the requirements of Rule 12(b)(6). The trial court considered defendant's attached copy of the assignment agreement, and plaintiff had a reasonable opportunity to present all pertinent factual claims in its response. Consequently, the trial court should have considered defendant's motion as one for summary judgment.
*432 We now turn to section 33-361. That section presupposes that an action brought under its provisions arises out of a lease relationship between the parties. The language of section 33-361(A) itself states, "[w]hen a tenant neglects or refuses to pay rent ... or when tenant violates any provision of the lease, the landlord ... may re-enter and take possession ... or ... commence an action for recovery of possession of the premises." (Emphasis added.) To proceed summarily under section 33-361(A), a landlord and tenant relationship must exist between a plaintiff and a defendant at the time the complaint is filed. In other words, section 33-361(A) is a summary proceeding available to a landlord who has an existing lease with a tenant. The statute is designed to determine whether the existing landlord and tenant relationship should be terminated for failure to pay rent or for breach of lease.
Here, defendant attached a copy of the First Assignment and Assumption of Lease and Landlord's Consent Agreement to its motion to dismiss. That agreement indicates that shortly after signing the June 1989 lease, defendant, with plaintiff's written consent, assigned the lease to Dub & Sal's with "all [of] Defendant's rights and obligations under the lease." Defendant thus made a prima facie case that because it assigned its obligations under the lease agreement to Dub & Sale's, no landlord and tenant relationship existed between defendant and plaintiff.
In plaintiff's response, Anthony Orlich, Vice-President of Grossman Properties, managing agent for plaintiff, alleged in an affidavit that defendant's employees were observed on the premises in late May of 1990, and that defendant also negotiated with potential new franchisees about a lease of the premises. The Orlich affidavit, however, contains no evidence that plaintiff terminated Dub & Sal's tenancy or that defendant elected to exercise its option to reassume the lease in accordance with the lease terms. Because defendant assigned the lease to Dub & Sal's (with plaintiff's written consent), Dub & Sal's had both a contractual right to possession and an estate in the premises. Riggs v. Murdock, 10 Ariz. App. 248, 252, 458 P.2d 115, 119 (1969); Harbel Oil Co. v. Steele, 83 Ariz. 181, 184-85, 318 P.2d 359, 361 (1957). Until plaintiff terminated Dub & Sal's existing tenancy for non-payment of rent, Dub & Sal's was entitled to possession of the premises. Consequently, defendant's presence on the premises and its lease negotiations with potential new franchisees, while possibly of consequence to Dub & Sal's, were of no legal significance to plaintiff.
A grant of summary judgment is appropriate when the trial court finds no material facts in dispute and the moving party is entitled to judgment as a matter of law. Do v. Farmers Ins. Co of Arizona, 171 Ariz. 113, 115, 828 P.2d 1254, 1256 (App. 1991). Taken in a light most favorable to plaintiff, the Orlich affidavit does not establish a disputed issue of fact that a landlord and tenant relationship existed between plaintiff and defendant. Because plaintiff failed to establish that defendant reassumed the lease previously assigned to Dub & Sal's, defendant is entitled to judgment as a matter of law in the summary proceeding brought under A.R.S. section 33-361. Accordingly, the trial court erred in not dismissing the action.
Even assuming plaintiff had established that a genuine issue of fact existed whether defendant had reassumed the lease, plaintiff was not entitled to try the issue in a summary proceeding. In a summary proceeding under section 33-361, a trial court cannot grant relief that is only available in a general civil action. Section 33-361 proceedings shall be "commenced, conducted and governed as provided for [in] actions for forcible entry or detainer ...." A.R.S. § 33-361(B) (1990) (emphasis added). An action brought under the applicable section of the forcible detainer statute, A.R.S. section 12-1171(3),[4] lies only when the premises are *433 demised or leased to the defendant. Moore v. Blackstone, 20 Ariz. 328, 329, 180 P. 526, 527 (App. 1919).
Forcible entry and detainer is a statutory proceeding whose object is to provide a summary, speedy and adequate means for obtaining possession of premises by one entitled to actual possession. DVM Co. v. Stag Tobacconist, Ltd., 137 Ariz. 466, 467, 671 P.2d 907, 908 (1983); Heywood v. Ziol, 91 Ariz. 309, 372 P.2d 200 (1962). Neither the forcible entry and detainer statute nor section 33-361 are intended to provide a remedy to a party seeking what is, in effect, a declaratory judgment that a valid lease exists between the parties. The issue in a summary proceeding under section 33-361 is not whether the parties have created a landlord and tenant relationship but whether an already existing lease should be terminated and possession awarded to the landlord because of the tenant's breach of lease or nonpayment of rent.
Other courts with forcible entry and detainer statutes similar to ours have held that forcible entry and detainer relief is limited. For example, the Washington Court of Appeals has stated:
where proceedings are commenced [under the forcible entry and detainer statute] the court obtains jurisdiction of the parties for only the limited statutory purpose of determining possession and damages sustained in that connection; and the court cannot transform such special proceedings into an ordinary law suit or grant relief therein as though the action were a general proceeding.
Lees v. Wardall, 16 Wash. App. 233, 554 P.2d 1076, 1079 (1976) (citations omitted). Stated another way,
[a]ny issue not incident to the right of possession within the specific terms of [the forcible entry and detainer statute] ... must be raised in an ordinary civil action.
Pine Corporation v. Richardson, 12 Wash. App. 459, 530 P.2d 696, 699 (1975) (citations omitted).
Whether plaintiff and defendant had a valid lease is not a question incident to the right of possession, but rather an issue whose resolution is a prerequisite to determining which party is entitled to possession. In other words, before the court in a forcible entry and detainer action can determine whether the landlord is entitled to possession because the tenant has breached the terms of the lease, it must be undisputed that a lease exists between the parties. If the latter question is disputed, that dispute must be resolved in a general civil action and not in a summary proceeding under section 33-361.
The policy behind our holding is obvious; the summary proceedings authorized by section 33-361 and the forcible entry and detainer statutes do not furnish all of the procedural safeguards provided in a general civil action. "In order to provide an expeditious means of recovering possession, the [forcible entry and detainer] statutes provide for streamlined procedures." 2 Richard R. Powell, Powell On Real Property § 246[3] (1993). "Notice periods are short, pleadings are restricted, triable issues are limited, discovery is generally unavailable, and the judgment is promptly operative." Id. Here, defendant was denied its right to discover the identities of plaintiff's potential witnesses, to depose those witnesses, to obtain answers to interrogatories, and to utilize any other discovery methods provided under the Arizona Rules of Civil Procedure.
Furthermore, the plaintiff's use of section 33-361 proceedings deprived defendant of certain of its remedies. Because the only issue to be decided in a summary proceeding is the actual right of possession, DVM Co., 137 Ariz. at 467, 671 P.2d at 908, a trial court hearing a section 33-361 action governed under the forcible entry and detainer statute may not consider counterclaims, offsets, or cross-claims either as defenses or as claims for affirmative relief. Olds Bros. Lumber Co. v. Rushing, 64 Ariz. 199, 205, 167 P.2d 394, 397 (1946). Rather, a defendant may assert only legal defenses to a plaintiff's claim of right of immediate possession. Hinton v. Hotchkiss, 65 Ariz. 110, 116, 174 P.2d 749, 754 (1946). Thus, defendant was precluded from asserting a counterclaim *434 against plaintiff or a cross-claim against Dub & Sal's for indemnity.
Our result is not novel. Arizona has long recognized that claims and counterclaims for damages for breach of a lease, and attorney's fees incurred for the landlord's retaking of the premises, are not issues to be determined in a forcible entry and detainer action. See Gangadean v. Erickson, 17 Ariz. App. 131, 134, 495 P.2d 1338, 1341 (1972). Those issues are properly resolved in a general civil action. Id. The question of whether the parties have created a landlord and tenant relationship is a similar issue  and one likewise not properly determined in a summary proceeding.
Although the parties here did not argue that an existing landlord and tenant relationship is necessary in order to maintain an action under A.R.A. section 33-361, we are not precluded from raising the error on review. "`Parties cannot stipulate as to the law applicable to a given state of facts and bind the court.'" Word v. Motorola, Inc., 135 Ariz. 517, 520, 662 P.2d 1024, 1027 (1983) (quoting State Consol. Publishing Co. v. Hill, 39 Ariz. 163, 167, 4 P.2d 668, 669 (1931)). Furthermore, this is an error going to the foundation of the action which may be noticed and reviewed on appeal whether or not it was raised or assigned as error. Word, 135 Ariz. at 520, 662 P.2d at 1027. Accordingly, we are not prevented from raising the error.
CONCLUSION
The trial court erred by not granting summary judgment dismissing the section 33-361 action for failure to state a claim. For the foregoing reasons, we reverse the trial court's judgment in the section 33-361 action. Defendant's defenses in CV 90-25424 are no longer barred by principles of res judicata and collateral estoppel. Consequently, we vacate the order of the trial court granting plaintiff summary judgment in that matter and remand for a trial on the issues.
TOCI, P.J., and GRANT, J., concur.
NOTES
[*]  The Honorable Michael J. O'Melia, Judge of the Maricopa County Superior Court, was authorized to participate in this matter by the Chief Justice of the Arizona Supreme Court, pursuant to Ariz. Const. art. 6, § 31.
[2]  Plaintiff later moved to dismiss this appeal on grounds that defendant failed to properly perfect it, and thus, we lacked jurisdiction. We denied that motion by order dated April 12, 1992.
[3]  Rule 12(b), Arizona Rules of Civil Procedure, provides in relevant part:

If, on a motion asserting the defense numbered 6 to dismiss for failure of the pleading to state a claim upon which relief can be granted, matters outside the pleading are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 56, and all parties shall be given reasonable opportunity to present all material made pertinent to such a motion by Rule 56.
[4]  A.R.S. section 12-1171 provides in relevant part:

A person is guilty of forcible entry and detainer, or of forcible detainer ... if he:
....
3. Wilfully and without force holds over any lands, tenements or other real property after termination of the time for which such lands, tenements or other real property were let to him or to the person under whom he claims, after demand made in writing for the possession thereof by the person entitled to such possession. (Emphasis added.)
