At the outbreak of the 1991 Gulf War, a lot of investors tried to scope out which firms would benefit from the conflict. Logic suggested defense contractors.

So "a lot of money flew into defense contractors," recalled Al Goldman, chief market strategist at St. Louis-based brokerage A.G. Edwards Inc. "They were very hot for a little while, but it ended quickly. People found out that those companies tied to the domestic growth of our economy" were where the action was.

The outbreak of war can be the turning point for a nation and its economy. World War II ended the Great Depression and set the stage for the economic prosperity and stock market boom of the 1950s.

But while it may be true that those who don't study history are condemned to repeat it, studying market history in an attempt to repeat it is risky business. Wars are not the same time after time, and neither are the economic consequences.

The history of war and stocks is fraught with surprises. World War II, with its heavy production of guns, ships and tanks, would presumably have been very good to the likes of General Motors and U.S. Steel. And it wasn't bad. GM rose by nearly half from the beginning of 1942 to the end of 1945. U.S. Steel gained about 16 percent.

But those numbers pale beside the gain posted by the stock of what was then the Gillette Safety Razor Co., which rose sevenfold over the same four years. It turns out that the military bought up all of Gillette's razor and blade production, but the company also moved into military contracting, producing carburetor parts for aircraft engines.

The stock of automaker Studebaker did well, too, quadrupling between the end of 1941 and the beginning of 1946.

But the stocks of World War II were coming off the lows of the Depression. Sorting out how much of their gains were directly related to the war and how much to the unprecedented level of government spending that the war required is at best a chancy business.

During the war years, large-company stocks produced average total returns of at least 19.75 percent (in 1944) and as much as 36.44 percent (1945), according to research by Chicago-based Ibbotson Associates.

But there was extreme volatility, as stock prices soared one day and plunged the next -- just as they are doing now -- with reports of the Allies' military fortunes

Nor was the shift from peacetime to war production always smooth. When automakers stopped making passenger cars in 1942, they had to retool their plants for military production. Then, as the war wound down, they had to shuffle the deck once more. There were also wage and price controls, and shortages, all of which restricted the civilian economy.

The wars of the late 20th century coincided with, though generally did not cause, fundamental changes in the U.S. economy. The Korean War (1950-53) was fought as the United States was entering a period of world dominance in industrial production. American steel, automobiles and communications were second to none. Large companies were carving out comfortable businesses for themselves. AT&T in 1950 proudly marked its 30th straight year of dividends. And some firms saw new opportunities: Gillette, which had been experimenting with "selling" television audiences since 1944, paid $7.3 million for the TV rights to six years of the World Series.

But by 1970, near the peak of the Vietnam War, these old-economy industries were starting to flounder as plant obsolescence, foreign competition and inflationary dislocations caused by the government's war spending ate into profits.

During the Vietnam War years, roughly 1963 to '73, the stocks of consumer-product companies, such as Gillette, saw reasonable gains, but others that might be expected to benefit from a war buildup -- such as U.S. Steel -- took a beating. Studebaker gave up its losing battle to remain a car company.

In 1964, the Bell Telephone system reported record earnings. But by 1973, though profits were still high, AT&T's chairman said some people were pushing the idea of breaking up AT&T. About the same time, the Soviet Union passed the United States as the world's leading steel producer.

All of these shifts together, coupled with the first oil embargo in 1973, amounted to an earthquake under the feet of many U.S. industries.

The 1991 Gulf War came just as the U.S. economy seemed to refocus from heavy industry to technology. Microsoft soft rose 130 percent that year.

Standard Oil of New Jersey and GM had both risen substantially during World War II as the economy improved and the government needed both petroleum products and vehicles. The stock of both GM and Exxon, Standard Oil's successor, fell when the Iraqis invaded Kuwait in 1990 and rose as the allies crushed the invasion in early 1991. Investors seem to have been more concerned with the price and availability of crude oil and gasoline than with government needs.

In fact, as the U.S. economy has grown, the portion of it devoted to defense and the military has become relatively smaller -- and so a war can break out with little fundamental rearrangement of the economy.

Psychology remains an important factor, however, at least in the short run.

Looking at five wars in the 20th century, "if you just take them on average from the beginning, the market was flat for six months, then rallied pretty steadily after that -- maybe after the outcome became more estimable," said Bob Prince, director of research and trading at Bridgewater Associates, a Wilton, Conn., institutional money-management firm. "A year after the beginning it was maybe up 7 percent."

Prince, who has studied the market's performance during and after wars, said he thinks "adverse surprises play a role." At the beginning, Vietnam was not seen as the major conflict it became, he said. The stock market rose in the early years of the American buildup in Vietnam but, like the country, soon bogged down in the conflict. An investor who put money into the market at the end of 1963 and matched the Dow's performance would have seen the investment climb about 26 percent by the end of 1965 -- and then give back all of those gains in the autumn of 1966.

A daunting reminder of how harsh markets can be: The Dow closed at 1051.69 on Jan. 11, 1973, fell back, and did not top that mark until late in 1982.

Several experts said that, while it's fun to look back at what stocks of individual companies did in different wars, trying to draw investment conclusions from those performances is futile.

"I'd be very careful with the idea that people should try to play the war based on a theme or success from another time period," said Langdon Healy, a mutual fund analyst at in Chicago.

He said someone might figure that the current war would lead to higher energy prices, which would benefit an energy-heavy mutual fund. "But energy prices haven't moved," he said.

"You shouldn't be looking at an energy fund based on the prospects of this war. You need to think about whether the longer-term picture for energy makes sense, and whether an energy fund fits with your portfolio," he said.

In other words, don't be like the generals who get into trouble by fighting the previous war.