
88 Cal.App.3d 72 (1979)
151 Cal. Rptr. 517
UNION OIL COMPANY OF CALIFORNIA, Plaintiff and Respondent,
v.
ROBERT A. MOESCH, Defendant and Appellant.
Docket No. 53625.
Court of Appeals of California, Second District, Division Three.
January 5, 1979.
*73 COUNSEL
Millstone, Berman & Wechsler, Millstone & Berman and Abraham Berman for Defendant and Appellant.
Buchanan & Besser and Robert Besser for Plaintiff and Respondent.
*74 OPINION
KLEIN, P.J.
Defendant Robert A. Moesch (Moesch) appeals from a judgment entered by the trial court in an unlawful detainer action upon a motion by plaintiff Union Oil Company of California (Union) for judgment on the pleadings.

STATEMENT OF THE CASE
Union's complaint alleged a lease agreement between Union as lessor and Moesch as lessee, executed on July 31, 1973, for real property which was to be used by Moesch to operate a gasoline service station. A copy of the lease was attached to the complaint as "Exhibit `A'" and incorporated therein by reference. The lease contained the following pertinent language: "The term of the lease commences July 31, 1973, and terminates July 30, 1976. The Lease ends automatically and without notice on the termination date. If the Lessee remains in possession of the Station after the termination date with Union's expressed or implied consent, Lessee is a tenant from month to month on the terms and conditions specified herein...."
The complaint further alleged that Moesch entered into possession on or about July 31, 1973; that pursuant to the above quoted language he became a month-to-month tenant on July 31, 1976; that on January 6, 1977, Union gave Moesch notice it was terminating the lease effective March 16, 1977; that said termination was "for good cause and legitimate business reasons"; and that although the lease was duly terminated on March 16, 1977, Moesch refused to vacate and surrender possession of the premises.
Moesch's first amended answer denied that there was good cause for termination of the lease, and affirmatively alleged the existence of a franchise arrangement between Union and Moesch (consisting of the lease and a separate "Retail Dealer Gasoline Storage and Purchase Agreement"), the applicability of Business and Professions Code section 20999.1,[1] and as required by said code section, the lack of good cause to terminate the lease. The first amended answer also contained other affirmative defenses.
*75 Union's motion for judgment on the pleadings was, in part, premised on the theory that the factual issue of good cause to terminate the lease was immaterial because section 20999.1 was enacted subsequent to the creation of the instant leasehold and thus could not be constitutionally applied here.[2] We disagree and reverse the judgment for the reasons to be discussed herein.

DISCUSSION
Section 20999.1 (fn. 1, ante) represents an attempt on the part of the Legislature to correct certain abuses it perceived to exist in franchise *76 arrangements between petroleum distributors and retail gasoline dealers. In enacting the statute, the Legislature declared that such arrangements affect "the general economy of the state, the public interest and the public welfare." (Stats. 1975, ch. 640, § 2, p. 1390.) By correcting the perceived abuses, the Legislature hoped to insure the continued availability to the public of a vital energy resource like gasoline at prices which reflect competitive and nondiscriminatory practices in the industry. (Ibid.)
Section 20999.1 seeks to bring about the intended results by prohibiting a petroleum distributor from terminating or failing to renew a retail gasoline franchise "without good cause." The term "good cause" is expressly defined in the statute and includes, among other grounds for termination or nonrenewal, the existence of "legitimate business reasons" (defined in a limited manner in the statute).
We note initially that there is no dispute between the parties as to whether the subject lease should be deemed part of a retail gasoline "franchise" as that term is defined in section 20999 (fn. 1, ante), the companion statute to section 20999.1. Indeed, Union stated in its points and authorities filed in support of the motion for judgment on the pleadings that "[t]he service station lease here in question would be considered a `franchise' [under section 20999] since it is an agreement between a petroleum distributor and a gasoline dealer under which the dealer is granted to [sic] right to occupy premises owned, leased or controlled by Union for the purpose of engaging in the retail sale of petroleum products." Furthermore, in Mobil Oil Corp. v. Handley (1978) 76 Cal. App.3d 956 [143 Cal. Rptr. 321], the court expressly recognized that in a fact situation like that presented here the landlord-tenant relationship generally exists only to facilitate a franchise arrangement between the parties, and that defenses arising from the franchise arrangement may therefore be properly raised in an unlawful detainer action. (Id., at pp. 962-963; see also Code Civ. Proc., § 1174, subd. (a), eff. Jan. 1, 1978 (fn. 4, infra).)
(1a) The parties do, however, dispute the applicability of section 20999.1. As in the court below, Union contends that because the statute did not become effective until January 1, 1976, it would constitute an unconstitutional impairment of the obligation of contracts and infringe *77 upon Union's vested rights if the statute were applied to a lease which had been in existence since July of 1973. Moesch controverts Union's contention in this regard, arguing that no impairment of contract or vested property rights would occur since the subject lease terminated automatically on July 30, 1976, and was thereafter renewed on a month-to-month basis subsequent to the statute's effective date.
(2) It is a fundamental principle of constitutional law that a statute may not, in general, be applied retroactively so as to impair an existing contractual obligation or deprive a person of a vested property right. (See Estate of Gill (1971) 19 Cal. App.3d 496, 501 [96 Cal. Rptr. 786].) Both the United States and California Constitutions specifically incorporate clauses prohibiting impairment of contracts (U.S. Const., art. I, § 10; Cal. Const., art. I, § 9; see 5 Witkin, Summary of Cal. Law (8th ed. 1974) Constitutional Law, § 619, p. 3918) and the cases are legion which recognize this precept (see Bradley v. Superior Court (1957) 48 Cal.2d 509, 519 [310 P.2d 634], and cases cited therein).
(1b) Were Moesch attempting to apply section 20999.1 to the original lease which was executed some two and one-half years prior to the effective date of the statute, we would be compelled, in accord with the decision in Mobil Oil Corp. v. Handley, supra, 76 Cal. App.3d 956, to hold any such attempted application unconstitutional. In the cited case, Division Two of this court held that an unconstitutional impairment of contractual rights would result if section 20999.1 were applied retroactively to a lease which had been executed (and, in that case, terminated without renewal) prior to the statute's effective date. (Id., at pp. 964-965; see also Globe Liquor Co. v. Four Roses Distillers Company (Del. 1971) 281 A.2d 19, 21.)
The present case, however, is distinguishable from the situation contemplated in Mobil Oil. Here, the original lease, by its own terms, terminated "automatically" on July 30, 1976. On that date, both parties were free of all obligations and conditions imposed by that lease. Furthermore, since the lease provided that Union's express or implied consent was required to continue the tenancy on a month-to-month basis, Union was, on July 30, completely at liberty to immediately reclaim its property and thus exercise whatever contractual or property rights had become vested under the original agreement between the parties. Instead, Union chose to negotiate with Moesch and thereafter to give its approval *78 to the creation of a new, month-to-month arrangement.[3] (Cf. Meredith v. Dardarian (1978) 83 Cal. App.3d 248, 253-255 [147 Cal. Rptr. 761], wherein this court held that defendant lessees were not liable for rent incurred by their assignee during a holdover period which was at the express discretion of the lessor; the rationale was that the month-to-month holdover was a new arrangement rather than a continuation of the original lease.)
In view of the above, using the good cause standard set forth in section 20999.1 to test the legality of Union's termination of the instant tenancy would not impair any contractual or property rights enjoyed by Union under the original agreement since that agreement terminated and was supplanted by the month-to-month arrangement. (Cf. Phillips Petroleum Co. v. Paradee Oil Co., Inc. (Del. 1975) 343 A.2d 610, 611-612, wherein the Supreme Court of Delaware held that the application of the state's franchise security act to petroleum distributorship franchises which were renewed subsequent to the act's enactment would not constitute an unconstitutional impairment of any contractual obligations.) Thus, when the present parties entered into negotiations upon the termination of the original lease and then agreed upon the new, periodic arrangement, it must be inferred that all law then applicable, including sections 20999 and 20999.1, became a part of their agreement. (Bodle v. Bodle (1978) 76 Cal. App.3d 758, 764 [143 Cal. Rptr. 115]; Masonite Corp. v. Pacific Gas & Electric Co. (1976) 65 Cal. App.3d 1, 8 [135 Cal. Rptr. 170].)
Having determined that section 20999.1 may be constitutionally applied in the case at bench, the disposition we must reach is manifest. (3) In ruling on Union's motion for judgment on the pleadings, the trial court was obliged to accept as true the portion of Moesch's answer alleging as a material fact that Union's termination of the lease was without good cause. (See Baillargeon v. Department of Water & Power (1977) 69 Cal. App.3d 670, 676 [138 Cal. Rptr. 338]; Hospital Council of Northern Cal. v. Superior Court (1973) 30 Cal. App.3d 331, 337-338 [106 Cal. Rptr. 247].) Since the pleadings thus disclosed the possibility of an affirmative defense under section 20999.1, it was error to grant Union's motion. (See Richter v. United Calif. Theatres, Inc. (1960) 177 Cal. App.2d 126, 128 [1 Cal. Rptr. 895]; Barasch v. Epstein (1957) 147 Cal. App.2d 439, 442 [305 P.2d 283].)
*79 In light of our holding herein, we deem it unnecessary to discuss Moesch's contention that Code of Civil Procedure section 1174,[4] as amended effective January 1, 1978, relates only to procedural matters in requiring a showing of good cause in unlawful detainer actions like the present one, and therefore may be applied retroactively. (See 5 Witkin, Summary of Cal. Law, supra, Constitutional Law, § 627, pp. 3924-3926.) Nor do we reach other arguments advanced by Moesch.
The judgment is reversed and the cause remanded for further proceedings consistent with the views expressed herein.
Allport, J., and Potter, J., concurred.
NOTES
[1]  Business and Professions Code section 20999.1 is preceded by the following list of definitions in section 20999:

"As used in this chapter, the term:
(a) `Petroleum distributor' means any person engaged in the sale, consignment, or distribution of petroleum products to retail outlets which it owns, leases, or otherwise supplies.
(b) `Gasoline dealer' means any person engaged in the retail sale of petroleum products in this state under a franchise or contractual agreement entered into with a petroleum distributor.
(c) `Franchise' means any agreement between a petroleum distributor and a manufacturer or between a gasoline dealer and a petroleum distributor under which the petroleum distributor or the gasoline dealer is granted the right to use a trademark, trade name, service mark, or other identifying symbol or name owned by the manufacturer or distributor, or an agreement between a petroleum manufacturer or distributor, and a distributor or dealer under which the petroleum distributor or the gasoline dealer is granted the right to occupy premises owned, leased, or controlled by the other party to the agreement, for the purpose of engaging in the retail or wholesale sale of petroleum products."
Section 20999.1 then provides:
"Notwithstanding the terms of any franchise, no franchisor shall terminate, cancel or refuse to renew any existing franchise without good cause.
"As used in this section good cause is limited to the following:
(a) The gasoline dealer or petroleum distributor failed to comply with essential and reasonable requirements of the franchise agreement;
(b) The gasoline dealer or petroleum distributor failed to act in good faith in carrying out the terms of the franchise; or
(c) For other legitimate business reasons (except that a termination, or cancellation of a franchise for the purpose of enabling the petroleum distributor or manufacturer to assume operation of the distributor's or gasoline dealer's business shall not be considered to be a legitimate business reason unless the gasoline dealer or distributor is paid reasonable compensation for the value of his franchise, including a reasonable amount for goodwill)." (Italics added.)
Unless otherwise indicated, all code section references hereinafter are to the Business and Professions Code.
[2]  In granting Union's first motion for judgment on the pleadings, which was instead treated as a demurrer to Moesch's answer, the trial court noted in its minute order dated August 1, 1977, that "[t]he principal basis for the ruling is the Court's view that defendant's reliance upon ... section 20999.1 as applying to contracts entered into before its effective date runs afoul of the constitutional prohibition upon impairing contractual obligations. No sufficient `emergency' exception has been alleged. No other pleaded defense is available in an unlawful detainer action or, if available, is sufficiently alleged."

Although Moesch was thereupon given 30 days to amend his answer, the first amended answer subsequently filed was substantially identical to the original, except for additional affirmative defenses alleging that the lease was a franchise agreement and that there were implied covenants and representations to the effect that termination could not occur without good cause. Union's second motion for judgment on the pleadings was granted on October 6, 1977, without further leave to amend.
[3]  Union's letter of January 6, 1977 to Moesch announcing Union's decision to terminate the tenancy, which letter was incorporated into the complaint as "Exhibit `B'" by reference, contained the following statement: "Due to negotiations between yourself and W.A. Fyock your lease has been extended on a month to month basis."
[4]  Code of Civil Procedure section 1174, subdivision (a), provides in pertinent part: "Except as provided in Section 1166a, in any action for unlawful detainer brought by a petroleum distributor against a gasoline dealer, possession shall not be restored to the petroleum distributor unless the court in the unlawful detainer action determines that the Professions Code to terminate, cancel, or refuse to renew the franchise of the gasoline dealer."
