Bank of America (BAC -7.63%) has been a much better investment than Toronto-Dominion Bank (TD -2.66%) over the past decade. In fact, Bank of America's stock price return alone is better than TD Bank's total return, which includes reinvested dividends.

But if you are a long-term dividend investor, the last decade isn't a long enough comparison to decide which is the better stock for your portfolio. Here's why.

Bank of America is doing well

Over the past decade, Bank of America has increased its dividend each and every year. That's not a bad streak. The stock has risen along with the dividend.

The overall result has been pretty nice for income investors. The dividend has increased by a huge 420%. The stock price alone has risen by nearly 169%. And if you reinvested the dividend, which adds up to the total return, the gain would have been 232%.

BAC Chart

Data by YCharts.

If you did a similar look back for TD Bank, the story wouldn't have been so rosy. The Canadian banking giant's dividend grew only 80% over the span (converted into U.S. dollars). The stock price rose just under 30%. And dividend reinvesting would have only increased that to 92%.

TD Chart

Data by YCharts.

There's no question that Bank of America's stock has been doing relatively well over the past decade. But the question is relative to what? The answer could change everything for a long-term dividend investor.

The Great Recession squashes the record

If you go back to the start of the century, roughly 25 years, the performance of Bank of America and TD Bank flips. TD Bank's stock price gain of 344% beats Bank of America's stock price gain of a mere 64% and its total return of around 215%. But look at TD Bank's total return in the graph below: It's a huge 989%.

BAC Chart

Data by YCharts.

The big difference between these two stocks over that span amounts to the way their businesses performed during the Great Recession. Bank of America struggled, took a government bailout, and ended up reducing its dividend. In fact, the dividend went from $0.64 per share per quarter to a mere token $0.01 per share, a level meant to allow institutional investors to continue owning the stock (some institutional investors can only buy dividend-paying stocks).

Interestingly, neither Bank of America's dividend nor its stock price are back above their levels prior to the dividend cut.

BAC Chart

Data by YCharts.

TD Bank didn't sail through the Great Recession unscathed. But it muddled through without a bailout or a dividend cut. So the dividend, which is growing again after a pause in growth during the Great Recession, is higher than it was prior to the recession, and so is its stock price. In fact, while the Great Recession looks like a cliff for Bank of America's chart, it is merely a blip for TD Bank.

Avoiding that blow, which took down many U.S. banks, has resulted in TD Bank being a much better long-term investment. Consistency matters. The only reason Bank of America looks better over the last decade is because it is recovering from the impact of the Great Recession.

An opportunity to buy TD Bank

That said, TD Bank is facing its own troubles today. Its U.S. business was used for money laundering, and that has investors worried about the company's growth prospects. The dividend yield is a historically high 4.8% or so.

While TD Bank is likely to be a laggard until it regains regulator trust in the U.S. market, it is still increasing its dividend thanks to still-strong performance in its Canadian business. If you are the kind of dividend investor who thinks in decades, this is an opportunity to buy a well-run bank that has rewarded investors well via consistent performance in both good times and bad.