There are plenty of arguments for and against paying off your mortgage early.

One of the big arguments that favors investing over paying down your mortgage is that you can expect a higher return from investing in the stock market, compared to the interest rate on your loan. But that’s not always the case. Anyone who invested in the stock market during the late ’90s or early 2000s lost money on their initial investments over the following 10 years.

But even in cases where the stock market’s average annual return lags your mortgage rate while you rapidly pay down your debt, you might still end up ahead in the long run if, instead, you invest while paying off your mortgage slowly. Because periods of poor returns are often followed by periods of better-than-average returns, those choosing to invest over paying down their mortgage see a greater benefit from those bigger returns by already having a significant amount invested in the market.

This is called the sequence-of-returns risk. While the sequence of returns is often considered in retirement drawdown strategies , investors should also consider the sequence of returns in the accumulation phase. A good sequence of returns in the accumulation phase could mean a lot more money in your portfolio by the time you’re ready to retire. A bad sequence means you’ll have to work longer than anticipated.

A couple holding each other walking toward a house.
Image source: Getty Images.

What’s a good sequence of returns?

In retirement, people often fear a big drop in the stock market right after they decide to retire. People retiring in January of 2000, for example, would have had a terrible time in retirement as the stock market crashed about 30% over the next 20 months or so. Then, just as the market was getting back to even in 2007, it crashed another 50% over the next 18 months. Meanwhile, the retirees were withdrawing funds from their portfolios to live off of.

That’s a poor sequence of returns, and it’s why investors usually diversify away from stocks as they near retirement and in the first few years after retirement.

But that sequence of returns is actually not so bad for someone slowly accumulating wealth.

Someone consistently putting money into the stock market starting in 2000 hasn’t done so terribly. If you invested the same amount every month in an S&P 500…