NEW YORK ( MainStreet) — Are you locked in a lease you need to get out of? Maybe you got a killer job offer on the other side of the state. Maybe you want to move closer to your family. Maybe you just can't deal with all the plumbing problems or a recurrent roach infestation. No matter what the reason, you can get out of your lease if you do things the right way. However, knowing the law, your rights and the basics of contract law makes it far more likely that you're going to end up out of your apartment without spending thousands of dollars for the privilege.

Tenant Law Is Renter's Law Is Contract Law

"The most common way to get out of a lease is when one party has breached the lease," says Nima Farahani, a lawyer based outside of Los Angeles. "It's not just tenants' rights, it's also contract law."

Farahani notes that "people get what it means to rent just about anything else, [but] when you start talking about real estate, people stop getting it." He uses the example of a car rental. "If you rent a car from Enterprise and the transmission doesn't work, no one thinks that they have to pay to repair it."

There are two places to attack a contract, explains Farahani: at its inception and after its execution. Objections to the contract itself include duress, fraud, force or inducement. These are uncommon when getting out of a lease. More common are finding ways that the contract has been broken by the other party, or simply shouldn't be enforced.

For example, Farahani cites a case where an American rented an expensive apartment in London to watch a parade with the queen. The queen cancelled, however, so the renter wanted his money back. He ultimate won under what is called "frustration of purpose."

"He had obviously rented the apartment for that purpose," Farahani said. "When he couldn't use it for that anymore, he was no longer bound by the contract."

The main way that your landlord is going to break an existing lease is by failing to make your apartment habitable.

Habitability Law: The Renter's Best Friend

"If the landlord has duties to perform that he's not performing, you can get out of your lease," says Farahani. What duties he needs to perform are going to vary from one state to another, but they're all roughly the same: your landlord needs to provide you with quiet enjoyment of a habitable property. What's more, he needs to maintain this habitability.

Failure to do so is what is known as "constructive eviction" or "partial eviction." For example, if you have roaches in your kitchen and the landlord refuses to do anything about it, you have effectively been evicted from your place because the landlord is not maintaining a habitable environment. This means that you can legally vacate the premises without penalty.