CEO Jamie Dimon and his team took a radical stance when they fled the booming subprime business in 2006.

NEW YORK (Fortune) -- It was the second week of October 2006. William King, then J.P. Morgan's chief of securitized products, was vacationing in Rwanda. One evening CEO Jamie Dimon
tracked him down to fire a red alert. "Billy, I really want you to watch out for subprime!" Dimon's voice crackled over King's hotel phone. "We need to sell a lot of our positions.
I've seen it before. This stuff could go up in smoke!"

That call marked the beginning of a remarkable strategic shift that helped J.P. Morgan (JPM,
Fortune 500) sidestep the worst of a historic credit crisis. J.P.
Morgan mostly exited the business of securitizing subprime mortgages when it was booming. With the notable exception of Goldman Sachs (GS, Fortune 500), J.P. Morgan's main competitors - including Citigroup (C, Fortune 500), UBS (UBS), and Merrill Lynch (MER, Fortune 500) - ignored the danger signs and piled into those products in a
feeding frenzy. (This is an excerpt from a story that ran in the Sept. 15 issue of Fortune. For more on Dimon and the team of talented lieutenants who helped J.P. Morgan dodge the
credit crisis, read the full story)

Make no mistake: J.P. Morgan is also suffering from the credit crunch. While it largely dodged the subprime bullet, J.P. Morgan stumbled in two other areas: funding dubious deals in
the LBO frenzy and jumping into the jumbo mortgage market when other banks were getting out. The third quarter is already looking tough. The company has announced that it is taking
$1.5 billion in mortgage and leveraged-loan write-downs, and another $600 million to account for the decline in the value of its Fannie Mae and Freddie Mac preferred stock.

Still, J.P. Morgan is weathering the crisis far better than its rivals. From July 2007, when the cyclone began, through the second quarter of this year, J.P. Morgan took just $5
billion in losses on high-risk CDOs and leveraged loans, compared with $33 billion at Citi, $26 billion at Merrill Lynch, and $9 billion at Bank of America (BAC, Fortune 500). And in this market, losing less means winning big. Before the
crisis J.P. Morgan was a middle-of-the-pack performer; today it leads in nearly every category, starting with its stock. Since early 2007, its share price has dropped 24%, to $37 (as
of Aug. 27), vs. declines of 44% for Bank of America and 68% for Citigroup. Last year its market cap was far below those of Citi and BofA. Today J.P. Morgan stands in a virtual tie
with BofA for first place among U.S. banks, and it towers over Citi.

That is largely thanks to J.P. Morgan's decision to shun subprime CDOs - vehicles that sell bonds backed by pools of subprime mortgage-backed securities. J.P. Morgan has long ranked
among the biggest buyers of auto and credit card loans, which it turned into asset-backed securities. But even in 2005, J.P. Morgan remained a small player in the hottest business on
Wall Street, securitizing mortgages. Dimon wanted to build a far bigger franchise, chiefly by securitizing the loans made by the bank itself through its Chase Home Lending division.
By 2006, J.P. Morgan was growing substantially in securitizing mortgages and dabbling in subprime CDOs, a business that was generating billions in fees for other Wall Street firms.

But Dimon soon began to see reasons to pull back. One red flag came from the mortgage servicing business, the branch that sends out statements, handles escrow, and collects payments
on $800 billion in home loans, its own and others'. During a regular monthly business review for the retail bank in October 2006, the chief of servicing said that late payments on
subprime loans were rising at an alarming rate. The data showed that loans originated by competitors like First Franklin and American Home were performing three times worse than J.P.
Morgan's subprime mortgages. "We concluded that underwriting standards were deteriorating across the industry," says Dimon.

Steve Black and Bill Winters, co-heads of the investment bank, were discovering more reasons to be cautious. CDOs issue a range of bonds, from supposedly safe AAA-rated ones with
relatively low yields to lower-rated ones with higher yields. Winters and Black saw that hedge funds, insurance companies, and other customers were clamoring for the high-yielding CDO
paper and were less interested in the other stuff. That meant banks like Merrill and Citi were forced to hold billions of dollars of the AAA paper on their books. What's wrong with
that? Doesn't an AAA rating mean the securities are safe? Not necessarily.

In 2006, AAA-rated CDO bonds yielded only two percentage points more than supersafe Treasury bills. So the market seemed to be saying that the bonds were solid. But Black and Winters
concluded otherwise. Their yardstick was credit default swaps - insurance against bond failures. By late 2006 the cost of default swaps on subprime CDOs had jumped sharply. Winters
and Black saw that once they bought credit default swaps to hedge the AAA CDO paper J.P. Morgan would have to hold, the fees from creating CDOs would vanish. "We saw no profit, and
lots of risk, in holding subprime paper on our balance sheet," says Winters. The combined weight of that data triggered Dimon's call to King in Africa. "It was Jamie who saw all the
pieces," says Winters.

In late 2006, J.P. Morgan started slashing its holdings of subprime debt. It sold more than $12 billion in subprime mortgages that it had originated. Its trading desks dumped the
loans on their books and mostly stopped making markets in subprime paper for customers. J.P. Morgan's corporate treasury under Ina Drew even starting hedging, betting that credit
spreads would widen. Over the next year those hedges reportedly yielded gains of hundreds of millions of dollars.

Dimon's stance was radical: He was skirting the biggest growth business on Wall Street. J.P. Morgan sank from third to sixth in fixed-income underwriting from 2005 to 2007, and the
main reason was its refusal to play in subprime CDOs, which its rivals were gorging on. "We'd get the quarterly reports from our competitors and see that they'd added $100 billion to
their balance sheets," says Dimon. "And they were hardly adding any capital, so it looked like their investments were almost risk-free." But in the end, of course, the decision to
shun subprime made Dimon a hero.

(This is an excerpt from a story that ran in the Sept. 15 issue of Fortune. Read the full story)