The last thing most landlords and tenants want to face is an eviction. For landlords, it’s messy, time-consuming and can be costly. For tenants, eviction can hurt their chances of renting another home, and could even leave them homeless.

There are ways to prevent a landlord-tenant relationship from ending in eviction, including proper tenant screening and conducting thorough tenant credit checks. But even good tenants lose jobs or have unexpected medical bills that can lead to difficulty paying rent. And when they stop paying rent, and won’t move on their own, eviction is the landlord’s legal recourse.

Depending on the state you live in, landlords are typically required to follow a strict protocol and process of notifying a tenant of impending eviction. Whether or not the tenant decides to fight the notice will determine whether the process goes quickly or drags out. The latter will add time and legal fees to the landlord’s case.

Other legal fees a landlord typically encounters in an eviction case include unlawful detainer for each adult in the rental unit, judgment, garnishment and service fees.

If you win your case, you then must remove the tenant from the property. In most states, you cannot just throw a tenant’s belongings out on the sidewalk. Typically, local law enforcement serves a notice and gives the tenant several days to leave. If they don’t, they will be removed by law enforcement.

In a few states, landlords are allowed to dispose of property a tenant leaves behind, but in most places, you’ll need to store the tenant’s property and follow proper notification procedures. In New York and New Jersey, for example, a landlord must store an evicted tenant’s belongings for 30 days, resulting in additional costs that are rarely recovered.

Expenses for cleaning and repairs add to the losses experienced by the landlord, since any security deposit paid by the tenant has likely been offset by loss of rent and legal fees.

By properly pre-screening tenants, offering an iron-clad lease to qualified applicants, and requiring strict adherence to rent due dates, landlords can establish a business model that lessens the chances of eviction—and saves them significant money and time.