BY TIM GRENDA, J.D.

Imagine you’re renting a house and living there with your family. You pay your rent on time and you think everything is fine. Then one day, out of the clear blue, you find a legal notice taped to your front door or you receive a letter in the mail telling you that the property where you live is in foreclosure.

It’s a frustrating, unsettling, and scary situation which has become all too common in the housing and mortgage crisis. Millions of renters have been displaced by foreclosures, but it is especially bad in California, where one study found that 37 percent of foreclosed properties were occupied by renters. Many renters do not know their legal rights in the event they are caught up in a foreclosure.

Most state foreclosure laws favor property owners over renters, in part because courts have long sought to protect property ownership as a fundamental American right. One of the primary legal principles in this area is the concept of "first in time is first in right," which gives preference to the title holder of property over renters or parties with leases. The general idea is, if you rent property which is subject to a mortgage, the mortgage holder’s interest in the property is senior to yours because it was entered into first.

Also, some leases may contain specific clauses regarding a tenant's rights with regard to foreclosure and giving the landlord the right to legally terminate the lease in case of foreclosure. So it's always a good idea to carefully review your lease agreement and your state laws to determine your rights and obligations.

However, if you are renting a foreclosed home, you do have some rights. Also, there are things you can do to protect yourself and your family from renting a foreclosed property in the first place.

The most significant recent development in the rights of tenants in foreclosure is the Protecting Tenants in Foreclosure Act of 2009. The federal law, which took effect in March 2009, gives tenants a right to 90-days notice to vacate after foreclosure before they can be evicted. Before the law passed, most states only required 60 days notice to evict tenants in a foreclosure.

The law also requires new owners after foreclosure to allow tenants with leases to continue occupying the property until the end of the lease term. The only exception, and it’s a big one, is that the lease can be terminated on 90 days’ notice if the unit is sold to a buyer who intends to occupy the property as a primary residence.

The PTFA gave a break to millions of tenants living in foreclosed properties, the bad news is, the law is only good through 2012. At that point it is set to expire, unless the law is extended or made permanent.

In addition to the protections afforded tenants under the PTFA, renters of foreclosed properties may be able to sue the owner of the property in small claims court. Renters may be able to sue for breach of contract or on other grounds to request return of rent or a security deposit on the property from the landlord. You may even have legal rights to seek money from your foreclosed landlord for the costs of your move, finding a new place to live, and other costs associated with the foreclosure.

Of course, the question remains whether a landlord who is in foreclosure has the money to repay renters who are out rent or security deposits. Be sure to consult with an experienced real estate law attorney in your area to find out more about all your legal rights as a tenant of a foreclosed property.

So, you now know that you do have some rights if the home you are renting goes into foreclosure. But what can you do to avoid renting a foreclosed property in the first place?

First, it’s a good idea to check to see if the property you are thinking of renting is in foreclosure before you sign on the dotted line. Foreclosures and Notices of Default (which come before a foreclosure) are matters of public record. Most of the time, all it takes is a trip down to the county assessor or recorder’s office to run the address through a computer. Some counties even let you do a foreclosure or Notice of Default search on-line for free.

You may also want to check if the landlord has recently refinanced or purchased the property, which could be a sign that a foreclosure filing maybe be in the works. It’s not for sure that a recently refinanced or purchased home is headed to foreclosure, but it could be a warning sign of potential problems ahead.

You can read more about your rights as a renter in a foreclosed property in LawInfo’s Landlord-Tenant Legal Resource Center.