By Shawn Leamon

Learn more about Shawn on NerdWallet’s Ask an Advisor

The marital home is many couples’ most valuable asset, so deciding what to do with it during divorce can be difficult. You and your soon-to-be ex have two basic options: sell the home, or one of you stays in it. If you stay, there are two ways to handle the mortgage.

Each option has pros and cons, so you’ll have to weigh what’s right for you carefully.

If you sell your home and pay off your mortgage, you can put both behind you. You can also use the profits to pay down other shared debts. However, if your home appreciated substantially while you owned it, you might owe capital gains taxes on the proceeds.

And depending on the state of your local housing market, you might not be able to sell your home for a profit. If you still owe a balance on your mortgage after the sale, you and your soon-to-be ex-spouse will need to decide how to best pay it off, unless the bank approves a request to release you from liability.

» MORE: How to sell your house

Perhaps you want to retain some sense of normalcy for your kids, or you have an underwater mortgage. If selling your home isn’t the ideal solution, one of you might want to take it over, along with the mortgage payments. Here, you (or your soon-to-be ex) have two ways to approach this choice.

If you refinance the mortgage, the new home loan will be in your name only with new terms based on your creditworthiness alone. The interest rate and monthly payments on a refinance could become more expensive. Your ex might need to sign a “quitclaim deed,” which would remove his or her property rights.

You can also try to assume the existing mortgage without refinancing. In other words, you remove your ex’s name but keep the same loan terms. If you go this route, the lender will still need to determine your individual creditworthiness.

In this case you would also need a quitclaim deed; otherwise your ex-spouse would still have rights to the home. For instance, in the event of the sale, he or she would be entitled to a portion of the proceeds. More importantly, as a practical matter, almost no bank would allow one person to assume a mortgage without also having sole ownership of the home.

The ease with which this can be done varies. Sometimes it can be done for a few hundred dollars. In some cases, such as with expensive homes in restrictive condo buildings, it can cost tens of thousands of dollars.

It can be tough to keep a clear head during this emotional, tumultuous time, but you should still be making rational decisions about your finances. Understanding your options can help you and your soon-to-be ex-spouse make the right financial decisions.

Shawn Leamon is the host of the “Divorce and Your Money” podcast and managing partner of LaGrande Global, with offices in Dallas, New York and Hanover, New Hampshire.

The article How to Handle Your Home During Divorce originally appeared on NerdWallet.