What happens to your debts after you die?

When you die, you don't just leave behind your family and your legacy. You also leave behind your debts.

But what happens to those debts once you're gone? In general, your assets and debts become part of an estate. It's the estate's responsibility to pay them. If there's any money left, it goes to your heirs. If there's not enough money to cover all the debts, they may go unpaid.

It can get complicated though, so here are a few things you should know:

SETTLING THE ESTATE: A will typically names an executor, who is responsible for settling the financial affairs of the deceased. If there is no will, the state decides who should handle it. That person follows a pecking order of who gets paid first, said Greg McBride of Bankrate.com. Secured debts, like mortgage or auto loans, come first; unsecured debts, such as credit cards and medical bills, follow.

HOME: Banks expect to continue to be paid for a mortgage or they will take action. But some protections exist for family members or others living in the home, said Chas Rampenthal, general counsel at LegalZoom.

Federal law prohibits a bank from automatically foreclosing when a home owner dies. There are also some protections to allow family or those living in the house to keep it, as long as they continue paying the mortgage. Ask the lender what your options are.

AUTO: Automobiles that are not paid in full do not have the same protection. However, lenders typically do not come to take back a car as long as someone continues to pay for it, Rampenthal said. Rules vary state by state as to which assets are protected and which aren't, so it may be worth consulting a lawyer.

CREDIT CARDS: Credit card debt can get a bit tricky.

If the credit card is yours alone, the debt belongs only to you as well — even in death, said Matt Schultz, senior industry analyst at Creditcards.com. In that case, the estate handles it. If it's a joint account or there is a co-signer, the other party is likely responsible for the balance as well. But if you are just an authorized user, you most likely won't have to pay. Things get fuzzier if you live in a community property state such as California, Arizona or Texas.

It's a smart idea to find a lawyer who knows the rules in your state.

"There is an awful lot of grey," Schultz said. "The last thing people need in this sort of time is vagueness and ambiguity."

COLLECTORS: The Federal Trade Commission says family members typically are not obligated to pay the debts of a deceased relative from their own assets.

The FTC also says debt collectors are restricted in who they can contact about the debt of the deceased. They're also prohibited from abusive, unfair or deceptive practices to try to collect a debt. But that doesn't stop some from trying.

Report any problems you have with a debt collector to your state attorney general's office and the Federal Trade Commission. Many states have their own debt collection laws that are different from the federal rules, so your attorney general's office can help you determine your rights.