Recently, I did an investigation into the performance of a group of the largest U.S. banks going back to 1980. There were some shockingly poor performers, as well as some high-flying multi-baggers.

As I reflected on that exercise, a few lessons really emerged for picking bank stocks for the next 35 years. One of those lessons is the difference between what I will call "good" profits and "bad" profits. Let's dive in.

Bad profits
Legendary bank CEO John Medlin of Wachovia said that the key to running a solid bank was to pursue a "three-legged stool" strategy. The bank needs all three legs to stand, and those legs represent soundness, profitability, and growth.

Medlin was always quick to point out that, of the three legs, soundness was the most important. This philosophy proved itself to be true in my investigation, and it defined "bad" profits to me.

A bad profit is a profit that comes at the expense of soundness. It's poorly underwritten loans. It's an over-reliance on risky businesses like trading. It's getting greedy in ridiculously complex derivatives.

Consider Bank of America (NYSE:BAC), the fourth worst-performing stock in the analysis. How would Bank of America's business look today if it hadn't sacrificed soundness to take a headfirst dive into the subprime mortgage market by acquiring CountryWide?

Fellow Fool John Maxfield reckons that the bank has left $124 billion in profits on the table. That's a whopping opportunity cost for all the "bad" profits leading up to the financial crisis.

"Good" profits
My definition of "good" profits could reasonably be relabeled as "boring" profits. These profits are driven by an efficient operation that allows a bank to compete for, and win, the highest-quality loans. High-quality loans don't backfire on you five years down the road. (Seriously, can you believe that $124 billion opportunity cost for BofA?)

Good profits can also come from value-added service businesses like wealth management, insurance, trust services, and treasury management. Two of the top five banks in the analysis are custodian banks. State Street Corp (NYSE:STT) returned 62,680% on a total-return basis driven almost entirely by the bank's ability to provide best-in-class investment management services for its high-dollar clients. Northern Trust Corporation (NASDAQ:NTRS) was the No. 5 performer, returning 11,550%.

While other banks and financial institutions were suffering from massive losses and tanking stock prices in down economies, these fee-oriented income streams chugged along. Sure, revenue may have temporarily dipped, but the profit that remained didn't come at the expense of soundness. While BofA still struggles to recover from the crisis, companies like State Street and Northern Trust charge forward undaunted.

Great banks have the discipline to sacrifice "bad" profits for boring, "good" profits
Determining if a bank is generating "good" or "bad" profits is easier than you may think. Read the bank's 10-K filing, and make sure you understand how the bank actually makes its money.

What kinds of loans do they make? What other income streams does the bank have? What is the mix between lending income and fee income? Do you understand the risks in each income stream, both today and in the future?

Next, take a look at the bank's history in terms of both its fundamentals and its stock price. I know it's cliche, but history really does repeat itself. Look at the consistency of the bank's efficiency ratio, its return on assets, and its stock performance relative to competitors. If a bank has a history of chasing bad profits, you'll find evidence in the time periods of economic trouble -- the mid to late 1980s, the turn of the century, and of course, 2008-2012.

Yes, it takes a little work, but you'll be glad you did it when your bank stock turns up on the next list of top performers.