Exactly five years later, on Oct. 9, 2007, that bull market reached its peak. Within months, stocks around the world were tumbling into the worst bear market since the Great Depression.

A look at what happened over the two periods — from 2002 to 2007 and from 2007 to 2013 — shows a pattern of reversal.

What was best during the first period was worst during the next one, and vice versa.

The US stock market, as measured by the MSCI index that covers all major US stocks, doubled from 2002 to 2007. That was not horrible by any means. But every major market around the world did better. The MSCI index that includes all major stocks in the world except for American ones tripled.

After the 2007 peak, the declines were sharp and rapid for most markets until the bottom was reached on or close to March 9, 2009. US and world markets began to recover at about the same pace. But near the end of 2010, the United States began to do better than most markets, and that advantage accelerated in the summer of 2011.

By Wednesday, exactly six years after the peak, only two of the 15 largest stock markets in the world were higher than they had been at the 2007 peak: Switzerland and the United States.

Overall, the index for stocks outside the United States was 22 percent lower than it had been on Oct. 9, 2007, while the US market was up 7 percent.

The 2002-7 period brought attention and money to the BRIC countries — Brazil, Russia, India, and China. They were the four best performers of the period, each rising at least 400 percent.

But in the later period, they take four of the five bottom slots. Only Spain, which has been seriously hurt by the eurozone crisis and by the weakness of many of its banks, has done as badly.

The same pattern of reversal is apparent within the US stock market.

During the first period, the three worst-performing sectors within the Standard & Poor’s 500 were the two consumer groups and health care. Since then, those three groups have outperformed all the other sectors.

The three best sectors during the earlier period were energy, utilities, and materials, a category that includes natural resources stocks. None of them is now significantly higher than at the 2007 peak.

The summer of 2011, when the US market began to accelerate, did not at the time seem to be a propitious time to invest in the United States.

On Aug. 5, Standard & Poor’s lowered the government’s credit rating during fears of a government budget crisis and possible default. Since then, the US market has gained 38 percent, more than any other major market and well above the average of 11 percent for the rest of the world outside the United States.