If a job loss, medical bills or unexpected expenses have got your scrambling to pay your bills, you may have wondered whether it’s a good idea to liquidate your 401(k) account in order to pay them off. Before you take that step, which can subject you to substantial taxes and fees and throw your retirement plans into disarray, you should know that 401(k) accounts are exempt from collections if you file personal bankruptcy.

It’s true: Even if you have enough in your 401(k) to completely pay off your debt, that money will not be used to pay your creditors in personal bankruptcy. Instead, your credit card bills, medical bills and other qualifying debt can be restructured or wiped out altogether, depending on whether you file Chapter 7 or Chapter 13.

If you qualify for Chapter 7, most of your debts will be discharged. In Chapter 13, the bankruptcy court will set up a 3- to 5-year repayment plan based on your ability to pay. Once you’ve completed that plan, the remainder of your qualifying debts can be wiped out. Qualifying debts include most types of loans without collateral, such as credit cards, but not child support, alimony, most taxes or, in most cases, student loans. Car loans and home mortgages are subject to bankruptcy, but are handled in different ways depending on whether you want to keep the property.

For the majority of people, drawing down a 401(k) plan to pay off debt is not their best financial option. For one thing, 401(k) contributions are made on a pre-tax basis, but you have to repay 401(k) loans with money you’ve already paid taxes on, plus interest. Substantial initial fees may be required and, if you don’t pay it back within five years, you could owe taxes and a penalty. On top of that, most people stop contributing to the retirement account while they juggle bills, so their nest eggs aren’t growing.

If you are considering filing personal bankruptcy and have a 401(k) account, however, there is one very important thing to understand: your 401(k) is only exempt if you leave the money in the account until your bankruptcy is complete. Finally, if you have already borrowed against your 401(k) plan and can’t pay it back, bankruptcy may still be a good option for you.

Source: Fox Business, “Will my 401(k) be Safe if I File for Bankruptcy?” Justin Harelik, Bankrate.com, June 19, 2013