When your landlord breaks the law (© Comstock/Getty Images)

See if you can nail this question: One day the heat goes out in your apartment, and your landlord brings over a space heater. Do you: a) thank him; or, b) ask when the heating system will be up and running again?

Polite or not, the answer is "b." You can dole out a quick thanks for the heater if you like, but make sure all sides are clear: This is a temporary fix only.

Too many tenants fail here, unaware that by law the landlord must repair the primary heating unit — and air conditioning and major appliances, etc. — swiftly. Failure to do so breaches the rental contract and poses a safety risk.

So why is this critical for the tenant to know? Shouldn't the landlord know this? Isn't someone watching the landlord?

There's the problem: Many landlords aren't aware of their legal responsibilities, tenant advocates say. It's not as if landlords need a license, and no one is randomly checking up on them. Housing officials respond only if you, the tenant, call — and even then they're likely to ask, "Did you notify the landlord?"

Welcome to the world of renting, where it's up to you to be on alert. If something seems amiss or unfair, that's the time to ask, "Is my landlord breaking the law?" (See "How landlords get away with it")  If you think the answer might be yes, document the incident and, if necessary, contact a tenants association.

Housing laws vary from state to state, and even from town to town, but the basics tend to apply everywhere. For some ideas of what these look like, here are seven examples. See if you know the answer: "Is that legal?"

1. It's just a friendly little conversation — or is it?
You make an appointment to view an apartment. When you arrive, with your child in tow, the manager smiles and says, "Oh, I didn't realize you had a child. I'm concerned about safety; the fence around the pool is not secure."

Is the landlord violating federal anti-discrimination laws?

The answer's a little messy. Words alone don't break laws, unless you scream, "Fire!" in a crowded movie theater and cause immediate harm. But if that landlord rejects your application and leases to a childless person, you may very well get a friendly reception from a housing lawyer and a judge.

Under federal law, landlords cannot choose tenants based on familial status, age or health.

But many landlords either don't know this or believe they can subtly dissuade those people from applying. They might say to a parent or an older person: "Are you sure you'd want to deal with these stairs?"

"We routinely see this," says Adam Murray, executive director of the Inner City Law Center in Los Angeles.

"They will say, 'Oh, you have kids, I didn't realize that when you called. I really want to rent to single folks.' Or sometimes it's couched: 'I don't think the building is safe for kids.'

"Routinely, landlords will say this, and often they don't know," Murray says. "The question is: Is the landlord discriminating on that basis? The law is pretty clear — you can't not be renting to someone on the basis of that."

2. Locks changed? What do you expect when you don't pay the rent?
You are 30 days late paying the rent. The landlord has asked again and again for the money, and you still have not paid what's owed. Finally, the landlord changes the lock so you cannot enter, forcing you to either come up with the cash or leave.

This happens more than people realize, tenant advocates say, and it is a blatant violation of the law.

Even in Arkansas — one of the most landlord-friendly states in the nation — it's not OK for landlords to change the locks without going to court first and obtaining a judge's order.

"I have landlords all the time who will resort to strong-arm tactics and bullying tactics, where they will tell a tenant, 'I'm going to come tomorrow and I'm going to change the lock,'" says Dylan Potts, a landlord-tenant lawyer with Gill Elrod Ragon, in Little Rock, Ark.

Potts has even seen leases in which a tenant pre-authorizes the landlord to come in and change the lock if the tenant is three days late, for example.

What's your home worth?

"Even with the contractual term, that is void and against public policy," Potts says. A landlord can't write around the law. (See "Renters: Beware of these lease clauses.")

Tenants are routinely removed this way, he says. The problem is that tenants don't know their rights, and usually can't afford legal counsel. They think their only option is to leave.

Landlords, meanwhile, are surprised to learn that self-help eviction, as it's called, is not legal.

"I think the landlord, as the owner of the property, feels like he has the right to remove someone from the property if that person is not obliging with the terms of the contract," Potts says. But a judge and, later, police must carry out the eviction process.

"There has to be a sense of order in this process, and by giving the landlord total control, you strip the tenant of all potential defenses that the tenant may have to contest that type of eviction," Potts says. "It puts all the power in the landlord's hands to make all the decisions."

3. Your stuff? Sorry, it's not your place anymore
So the landlord got an order from a judge and legally changed the lock. If you weren't there, it's your tough luck if your possessions are inside his unit, right?

If you're getting the hang of this exercise, you may have guessed: The landlord most likely needs to make some effort to contact you. He can't help himself to the television because you owe him money. He can't toss your clothes on the sidewalk because he needs to clear the apartment and you didn't show up within 24 hours of the eviction date.

"The typical requirement is the landlord must go back to court if there is property maintained there by the tenant," Potts says. "There are landlords that will dispose of those possessions. My advice to landlords has always been to store the possessions."

Yes, after a reasonable amount of time, and after effort has been made to contact the former tenant, the property may be considered abandoned. A tenant can't reappear months later and try to claim his belongings.

But if a tenant was evicted only days or weeks before, or if he still legally resides there but has not paid the rent, the landlord cannot lay claim to his possessions.

"I see this tied a lot to the initial self-help eviction," Potts says. "There's no sheriff, no court. They go in and change the locks themselves, hold the stuff hostage, then bargain with tenants."

What's a tenant to do? Get help, the experts say.

"Any time anybody's getting evicted, they should be seeking legal assistance," Murray says. "There's a study that shows if you don't have an attorney, you're likely to lose.

"And on the landlord side, most will have an attorney. So you have a real mismatch of understanding what the rules are," he says. "It's not enough to just know these things."

4. Where's the security deposit?
So, like most tenants, you gave your new landlord a security deposit — probably the equivalent of one month's rent — upon moving in. You made the check out to him, tucked the receipt away, and that was that. You'll get the money back when you move out, as long as there's no damage to the unit. No problem there, right?

Not so fast. As a result of too many landlords' misuse of security deposits — they spent the money immediately then had trouble refunding it — several states have enacted laws that essentially keep an eye on that money for tenants.

In those states — Florida, New Jersey, Kentucky and Massachusetts are just a few — the landlord is required to put the tenant's security deposit into a dedicated bank account. He must then provide the tenant with the bank-account information.

In Massachusetts, for example, the tenant is also due the interest on that money if and when it is refunded. If a dispute arises later and the landlord has not properly handled the security deposit, a housing-court judge may order that the landlord pay the tenant triple damages. In other words, triple the amount of the security deposit.

"So let's say I go smash the walls and the landlord deducts from the security deposit," says Michael Kelley, director of rental housing resources for the city of Boston. "If I go to court and say, 'You never showed the deposit information,' the judge could rule against the landlord and award triple damages.

"Landlords are often ruled against on a technicality, and we want to protect them as well," Kelley says.

5. Are pet deposits treated differently?
A damage deposit by any other name is still a damage deposit and must be treated accordingly under that state's law. So if you handed over an additional $1,000 as a pet deposit, it must be treated the same as a security deposit.

6. The landlord wants even more security deposit later
Let's say you've lived in the apartment for five years, with no problems. Every year your rent has gone up 3%. Suddenly, your landlord requests an additional 10% in security deposit.

What do you do? Most often, you'll simply have to pay. Yes, this one is not illegal. However, it may be if the request is for an amount that exceeds the percentage increase permitted under state law.

However, in every case, if the landlord keeps any part of the security deposit after you move out, he must provide a written, detailed invoice of his deductions. In addition, he cannot deduct for normal wear and tear — for example, things such as light scuff marks, small picture pinholes or fading or dirty paint.

7. The pests aren't gone, but at least the landlord keeps spraying

You have a bedbug problem, and the landlord has the building manager attempt a sweep. Big surprise — the bedbugs return within days. The manager tries, and fails, again.

The landlord is not really violating any rules, is he?

In the end, he could be. Remember the space-heater example. When it comes to health and safety, it's not enough for a landlord to take a Band-Aid approach. Laws in 49 states require that landlords provide a fit and habitable dwelling.

"When we see rodents or any other infestation, we know that there are other problems that need to be fixed," Murray says. "They're not addressing the underlying problem. They're not keeping up the building."

So what should you always do?
The lesson all tenants need to learn, advocates say, is to document all problems, make requests in writing and, if issues are not resolved, contact a government agency or tenant group for help.