Buying your family home seemed straightforward enough. You and your spouse got the loan together, picked out the house and lived there for 10 years.

That time is coming to end, though, and now you’re getting divorced. You’re still 20 years away from paying off that mortgage. It’s natural to wonder if your divorce could send you spiraling toward foreclosure.

It doesn’t have to. Most couples will simply sell the home together. If the market worked in your favor or just held steady while you made payments, you should make a profit when selling. You can then split the profit.

However, there are situations where foreclosure comes into the picture. Maybe you want the home, and you refuse to sell. You give your spouse other assets and keep the home yourself. Quickly, though, you realize that you can’t afford that mortgage payment on a single income. Now the bank may foreclose.

Or, maybe your divorce is strictly because of debt. Your spouse was wasting money, and you haven’t even made a mortgage payment in months. You may be thinking about the end of your marriage, but the bank is already moving to foreclose on your home. They care less about the fact that your marriage ended and more about the fact that no one has paid them any of the money they were due.

If you do find yourself facing foreclosure, it can feel daunting, especially when already dealing with a divorce and all of the other issues that go along with it. Make sure you know what legal options you have so that you can work toward a positive future.