So you're in default on your mortgage. You've several months behind on your payments. You've tried and failed to get a loan modification and work out a repayment schedule, and foreclosure is looming. Should you consider declaring bankruptcy?

In terms of avoiding foreclosure, declaring bankruptcy might be considered the nuclear option. It has the power to wipe out many of a borrower's debts while holding other creditors at bay. It can enable a borrower to hold onto important assets such as a home or car, while working out a repayment schedule to get caught up on payments for them.

But bankruptcy is generally considered a last-ditch option for dealing with overwhelming debt. For one thing, you may have to give up many of your current assets, such as savings and certain investments, in the process. Bankruptcy also has a long-term impact on your credit rating, remaining on your credit report for 10 years - a foreclosure, on the other hand, only remains on your record for seven. However, there are circumstances when it might make sense to declare bankruptcy in order to hold on to a home in which you're emotionally and financially invested.

First of all, you're going to want to talk to an attorney if you're seriously considering filing for bankruptcy. A certified nonprofit debt or housing counselor (with who you should have already been working within your efforts to obtain a loan modification) can help you work out some of your options beforehand and help you determine if bankruptcy is something you want to explore, but you'll need an attorney to explain all the considerations involved in your personal situation and help you decide if you wish to proceed.

Avoiding foreclosure through Chapter 13 bankruptcy

David Ebert, a bankruptcy attorney and partner with Ebert Law Office PC in Hurst, Texas, said that most homeowners who resort to bankruptcy to avoid foreclosure will file a Chapter 13 bankruptcy. A Chapter 13 doesn't actually wipe out the debt, and serves to temporarily shield debtors from their creditors until a court-ordered repayment schedule can be worked out.

"It's intended for somebody who had a loss of income or a short-term decline in income," Ebert explained.

Once a Chapter 13 filing occurs, all debt collection efforts are halted for several months during what is called a forbearance period, during which a court will work out terms for repaying the debt. Usually, the court will set up a schedule over three to five years over which the debtor will repay the arrears, or debt owed.

Need to be able to maintain payment schedule

For a Chapter 13 to successfully avert a foreclosure, a homeowner must be able to pay off the arrearage while at the same time resuming his or her original mortgage payments - which can be a hefty financial burden. Otherwise, the property will soon fall back into foreclosure.

Ebert said it may be possible in some cases to work out a loan modification as part of the bankruptcy, thereby reducing the ongoing mortgage payments so the homeowner can more readily handle the burden of paying both the mortgage and arrears.

Another type of consumer bankruptcy is a Chapter 7, which Ebert said is rarely useful in avoiding a foreclosure or loss of other secured property. That's because while a Chapter 7 can wipe out unsecured debts, secured debts are tied to a specific asset - such as a mortgage secured by a home - which reverts to the creditor in a Chapter 7.

Chapter 7 can eliminate second liens after foreclosure

For a homeowner who has decided to go ahead and surrender their home through foreclosure, Ebert said a Chapter 7 may be useful for extinguishing potential claims by secondary lienholders, such as in the case of a home equity loan or second mortgage, who might otherwise seek repayment by laying claim to other assets held by the homeowner. Some states allow this, others do not - this is one of the areas where a bankruptcy attorney licensed to practice in your state can be helpful.

It should be noted that a bankruptcy does not provide relief from all debts - unpaid taxes, child support, alimony and loans obtained through fraud, among certain other debts, cannot be extinguished by bankruptcy.

Impacts on credit

Finally, there are the impacts on one's credit rating to consider. As mentioned above, a bankruptcy remains on your credit rating for 10 years, a foreclosure for only seven. However, many mortgage lenders may prefer to write a mortgage for someone with a bankruptcy on their record rather than a foreclosure.

Furthermore, many lenders will actively seek out persons who have recently filed for bankruptcy - Ebert said it's not uncommon for persons to receive credit card offers during the process itself. The bottom line is, credit can still be available after a bankruptcy - but it's going to be much more expensive than before. Bankruptcy and its impacts on your personal and financial life can be very complicated. That's why it's important to talk with a qualified bankruptcy attorney and preferably, a personal financial advisor as well to sort out the pros and cons before taking such a major step.