The landlord is required to return the portion of the security deposit that is not legitimately claimed for allowed damages.
Please see the following Arizona Statute.
33-1321. Security deposits
A. A landlord shall not demand or receive security, however denominated, including, but not limited to, prepaid rent in an amount or value in excess of one and one-half month's rent. This subsection does not prohibit a tenant from voluntarily paying more than one and one-half month's rent in advance.
B. The purpose of all nonrefundable fees or deposits shall be stated in writing by the landlord. Any fee or deposit not designated as nonrefundable shall be refundable.
C. With respect to tenants who first occupy the premises or enter into a new written rental agreement after January 1, 1996, upon move in a landlord shall furnish the tenant with a signed copy of the lease, a move-in form for specifying any existing damages to the dwelling unit and written notification to the tenant that the tenant may be present at the move-out inspection. Upon request by the tenant, the landlord shall notify the tenant when the landlord's move-out inspection will occur. If the tenant is being evicted for a material and irreparable breach and the landlord has reasonable cause to fear violence or intimidation on the part of the tenant, the landlord has no obligation to conduct a joint move-out inspection with the tenant.
D. Upon termination of the tenancy, property or money held by the landlord as prepaid rent and security may be applied to the payment of all rent, and subject to a landlord's duty to mitigate, all charges as specified in the signed lease agreement, or as provided in this chapter, including the amount of damages which the landlord has suffered by reason of the tenant's noncompliance with section 33-1341. Within fourteen days, excluding Saturdays, Sundays or other legal holidays, after termination of the tenancy and delivery of possession and demand by the tenant the landlord shall provide the tenant an itemized list of all deductions together with the amount due and payable to the tenant, if any. Unless other arrangements are made in writing by the tenant, the landlord shall mail the itemized list and any amount due, by first class mail, to the tenant's last known place of residence.
E. If the landlord fails to comply with subsection D of this section the tenant may recover the property and money due the tenant together with damages in an amount equal to twice the amount wrongfully withheld.
F. This section does not preclude the landlord or tenant from recovering other damages to which the landlord or tenant may be entitled under this chapter.
G. During the term of tenancy the landlord may use refundable security deposits or other refundable deposits in accordance with any applicable provisions of the property management agreement. At the end of tenancy, all refundable deposits shall be refunded to the tenant pursuant to this section.
H. The holder of the landlord's interest in the premises at the time of the termination of the tenancy is bound by this section.