Thank you for your question. I look forward to working with you to provide you the information you are seeking for educational purposes only.
Whether or not the landlord accepts the security deposit
in lieu of rent due is up to the landlord's discretion, as the law says the security deposit is for damages
(which can include damages for breach of lease). So, if the landlord chooses, they can keep the deposit for your breach of the lease for failure to pay rent and can pursue you for any rent due in court. Your failure to pay rent was a breach of the lease, so it is up to the landlord to agree to take the security deposit towards rent or to pursue the rent due separately.
California Civil Code Section 1950.5 only permits a landlord to use a tenant's security deposit to pay for the costs of: (1) unpaid rent; (2) cleaning the rental unit after you vacate (but only to what it was before you moved in); (3) repairing damage caused by the tenant that goes beyond normal wear and tear; and (4) if provided in the lease, replacing keys, laundry cards, garage openers, etc. California law does not permit a tenant to use his or her security deposit as a replacement for paying the last month's rent. If the lease states that the tenant paid first month's rent and "last month's rent" and a security deposit, then the tenant is relieved of paying the last month's rent.
However, the landlord had to give you written notice of his intent to keep your deposit for breach of the lease within 21 days of the termination of your tenancy and if they fail to do so then they cannot keep any of the deposit and must return that deposit to you and if they do not do so, you can seek up to two times the amount of the deposit in small claims court from the landlord.