Can My Landlord Evict Me for Calling Code Enforcement in California?
If you reported a habitability problem to your city's code enforcement department, your local housing authority, or another government agency — and your landlord subsequently served you with an eviction notice or filed an Unlawful Detainer Complaint against you — you may be facing an illegal retaliatory eviction. California law expressly prohibits landlords from evicting tenants in retaliation for exercising their legal rights, and calling code enforcement is one of the most clearly protected activities a California tenant can engage in. Understanding your rights and acting immediately to assert them is essential to protecting your home.
What is Retaliatory Eviction Under California Law?
Retaliatory eviction occurs when a landlord takes adverse action against a tenant — including serving an eviction notice, filing a lawsuit for unlawful detainer, raising the rent, or reducing services — in response to the tenant having exercised a legally protected right. In California retaliatory eviction is prohibited by Civil Code § 1942.5, which has been in place for decades and has been interpreted broadly by California courts to protect tenants who speak up about unsafe or uninhabitable housing conditions.
The defense of retaliatory eviction was first recognized by the California Supreme Court in Schweiger v. Superior Court (1970) 3 Cal.3d 507, in which the Court held that a landlord could not use the eviction process to punish a tenant for exercising the statutory right to demand repairs. The California Supreme Court subsequently confirmed in S.P. Growers Association v. Rodriguez (1976) 17 Cal.3d 719 that the retaliatory eviction defense extends broadly to encompass any lawful exercise of rights under the law — not merely complaints about habitability conditions. The Court reaffirmed this principle in Barela v. Superior Court (1981) 30 Cal.3d 244, holding that the defense of retaliatory eviction was "firmly ensconced in this state's statutory law and judicial decisions."
Is Calling Code Enforcement a Protected Activity Under California Law?
Yes. Calling code enforcement is one of the most directly and clearly protected activities identified in CC § 1942.5(a)(2). The statute expressly protects a tenant who, in good faith, has filed a written complaint — or an oral complaint that is registered or otherwise recorded in writing — with an appropriate agency, of which the landlord has notice, for the purpose of obtaining correction of a condition that the tenant reasonably believes to violate applicable provisions of building and housing codes materially affecting health and safety.
Code enforcement agencies — including city building and safety departments, housing departments, health departments, and similar government agencies — are precisely the type of "appropriate agency" contemplated by CC § 1942.5(a)(2). When a tenant reports mold, pest infestations, lack of heating, plumbing failures, electrical hazards, structural defects, or any other condition that materially affects health and safety to one of these agencies California law immediately protects that tenant from retaliatory action by the landlord.
The statute also separately protects a tenant who causes an appropriate agency to inspect the rental unit or to issue a citation to the landlord. CC § 1942.5(a)(3) This means that even if a code enforcement inspector came to the property and issued a notice of violation or citation to your landlord as a result of your complaint, you are expressly protected from retaliation based on that inspection and citation.
The 180-Day Presumption of Retaliation
California law provides California tenants with a powerful procedural protection: if a landlord serves a notice to recover possession, files an Unlawful Detainer Complaint, raises the rent, or reduces services within 180 days of a protected activity — including a code enforcement complaint — California law presumes that the landlord's action is retaliatory. CC § 1942.5(a)
The significance of this presumption cannot be overstated. Once the tenant establishes that the adverse action occurred within 180 days of the protected activity the burden shifts entirely to the landlord to produce evidence showing that the eviction or other adverse action was not motivated by retaliation. The landlord must demonstrate a legitimate, non-retaliatory reason for the adverse action. If the landlord cannot meet that burden the eviction will be barred.
The 180-day period runs from the latest applicable protected activity. This means that if a tenant filed a code enforcement complaint on one date and the inspector issued a citation to the landlord on a later date the 180-day period runs from the date of the citation — not from the earlier date of the complaint. CC § 1942.5(a)
Important Limitation: Under CC § 1942.5(a) the presumption of retaliation applies only if the tenant is not in default in the payment of rent at the time the adverse action is taken. If you owe rent at the time the landlord serves the eviction notice you will not be able to invoke the presumption under subdivision (a) — though other provisions of CC § 1942.5 and the common law retaliatory eviction defense may still be available to you. CC § 1942.5(a)
Additionally: A tenant may not invoke subdivision (a) of CC § 1942.5 more than once in any 12-month period. CC § 1942.5(b)
What If the Eviction Occurred More Than 180 Days After the Code Enforcement Complaint?
If the landlord's adverse action occurred more than 180 days after the code enforcement complaint the statutory presumption of retaliation under CC § 1942.5(a) does not automatically apply. However the tenant may still assert the retaliatory eviction defense under CC § 1942.5(d) — which broadly prohibits retaliatory eviction for any lawful exercise of rights under the law — though in that case the burden of producing evidence that the landlord's conduct was retaliatory rests on the tenant. The common law retaliatory eviction defense established in Schweiger v. Superior Court (1970) 3 Cal.3d 507 and affirmed in S.P. Growers Association v. Rodriguez (1976) 17 Cal.3d 719 and Barela v. Superior Court (1981) 30 Cal.3d 244 may also provide protection beyond the 180-day statutory window.
How Do You Raise Retaliatory Eviction as a Defense?
If you have received an Unlawful Detainer Summons in California and you believe the eviction is in retaliation for calling code enforcement or reporting a habitability violation to a government agency you must raise retaliatory eviction as an affirmative defense in your Answer to Unlawful Detainer Complaint (Judicial Council Form UD-105). The UD-105 contains a specific checkbox for the retaliatory eviction defense.
When you check the retaliatory eviction box on the UD-105 you must also state brief supporting facts in the designated section of the form. Your supporting facts should include the following information:
— The date on which you filed the code enforcement complaint or reported the habitability issue to the agency — The name of the agency to which you made the report — A brief description of the condition or violation you reported — The date on which your landlord received notice of the complaint or inspection — The date on which the landlord served the eviction notice or filed the Unlawful Detainer Complaint — The number of days between the protected activity and the adverse action
At trial you will be expected to present evidence to substantiate the defense. The most persuasive evidence in a retaliatory eviction case is typically a documentary record that establishes the timeline clearly. Evidence you should gather and preserve includes:
— A copy of the written code enforcement complaint you filed — or a written record of any oral complaint that was registered in writing by the agency — Any correspondence from the agency acknowledging receipt of your complaint — Any inspection reports, notices of violation, or citations issued by the agency to the landlord as a result of your complaint — Written communications between you and the landlord — including text messages, emails, and letters — in which you notified the landlord of the uninhabitable conditions before filing the complaint — A copy of the eviction notice served by the landlord showing the date of service — Any written or recorded statements by the landlord that indicate awareness of the code enforcement complaint prior to serving the eviction notice
The closer in time the eviction notice follows your code enforcement complaint the more compelling your retaliatory eviction defense becomes. Courts look closely at the timeline of events when evaluating retaliatory eviction claims.
What Are the Consequences for a Landlord Who Retaliates?
If a tenant successfully establishes the defense of retaliatory eviction in an unlawful detainer proceeding the eviction will be barred and the tenant will be adjudged the prevailing party in the case.
In addition to prevailing in the eviction case a tenant who has been subjected to a retaliatory eviction may bring a separate civil action against the landlord for damages. Under CC § 1942.5(h) a tenant may recover the following in a civil action against a landlord who violated the statute:
— Actual damages sustained by the tenant — including moving costs, increased rent in a new unit, lost wages, and any other costs caused by the retaliatory conduct — Punitive damages of not less than $100 and not more than $2,000 for each retaliatory act where the landlord or the landlord's agent acted with fraud, oppression, or malice — Reasonable attorney's fees — which the Court shall award to the prevailing party if either party requests attorney's fees at the initiation of the action CC § 1942.5(i)
These remedies are in addition to any other remedies available under statutory or decisional law. CC § 1942.5(j) Any agreement by a tenant to waive these rights is void as against public policy. CC § 1942.5(f)
What Other Activities Are Protected From Retaliation Under California Law?
The protection against retaliatory eviction in California extends well beyond code enforcement complaints. Under CC § 1942.5 a landlord may not evict, raise rent, reduce services, or otherwise retaliate against a tenant within 180 days of any of the following protected activities:
— Notifying the landlord of a suspected bed bug infestation — Making an oral complaint to the landlord regarding tenantability — Filing a written or recorded oral complaint with an appropriate government agency regarding habitability — Causing an appropriate agency to inspect the rental unit — After an agency issues a citation to the landlord following a tenant-initiated complaint — After entry of a judgment or arbitration award in which the issue of tenantability was determined adversely to the landlord
Under CC § 1942.5(d) a landlord is also prohibited from retaliating against a tenant for lawfully organizing or participating in a tenants' rights association or for lawfully and peaceably exercising any rights under the law — a protection that extends to a wide range of tenant activities including filing complaints with rent boards, making repair requests, and asserting rights under AB 1482.
Under CC § 1942.5(c) it is also expressly unlawful for a landlord to report — or to threaten to report — the tenant or individuals known to the landlord to be associated with the tenant to immigration authorities in retaliation for the tenant's exercise of their rights.
Your Deadline May be Approaching — Call Now
If you have received an Unlawful Detainer Summons after calling code enforcement or reporting a habitability problem to a government agency you must act immediately. Your deadline to file a responsive pleading with the Court is 10 court days from the date of personal service of the Unlawful Detainer Summons. Failing to file a timely response will result in a default judgment for eviction being entered against you — regardless of whether the eviction is retaliatory.
Tenant Eviction Defense is an IRS 501(c)(3) nonprofit organization headquartered in Newport Beach, California dedicated to providing education, information, and guidance to Southern California tenants facing eviction. If you have received an Unlawful Detainer Summons or a Notice of Unlawful Detainer after calling code enforcement or after reporting habitability problems to a government agency call our Eviction Defense Rapid Response Line immediately at (657) 510-6534, Monday through Friday from 8:30 a.m. to 6:00 p.m. Our staff is available to discuss your situation, explain your rights under CC § 1942.5, and help you understand the options available to you.
Updated April 12, 2026.

