An unexpected escalation in the trade war between the U.S. and China jolted investors into a defensive position in May.

Safe-play sectors including utilities and consumer staples held up better than others and bonds gained ground this month as investors shifted their money into traditionally less risky holdings. Technology and other cyclical stocks pulled back after surging all year.

Solving the global trade puzzle became more difficult earlier this month when the U.S. and China broke off negotiations without a deal and raised tariffs on each other’s goods. A prolonged trade war between the world’s two largest economies can threaten economic growth and corporate profits.

“These trade negotiations are going to have an effect on global growth,” said Scott Wren, senior global equity strategist at Wells Fargo Investment Institute.” It’s certainly a big part of the puzzle; what do negotiations mean for that.”

The trade tiff has upended a market rally. Technology companies are still showing a double-digit gain for the year, but they’re among the biggest losers in May as the Trump administration moves to curb sales of technology to Chinese companies. Shares of industrial and consumer products companies also slumped as they warned of higher costs from tariffs, with some saying U.S. consumers could be hit with higher prices.

Utilities and treasuries have been acting as a safe haven in the day-to-day storm of news on the trade front, said Craig Birk, chief investment officer at Personal Capital. The jump in bond prices has pushed the yield on the 10 year Treasury to 2.24%, a 20-month low, as of Wednesday.

“People are balancing the realization that this is something that lasts years, if not longer,” he said.

While trade anxiety is dominating the headlines, Morgan Stanley is warning investors that weak economic data globally should be raising red flags. Business purchasing and capital spending has been weaker than anticipated. That could mean a disappointing earnings rebound in the second half of the year and a big risk to U.S. economic growth.

“A lot of (earnings) growth that is still expected for 2019 is being packed into the fourth quarter and that looks unrealistic to us, with or without a trade deal,” wrote Morgan Stanley equity strategist Michael J. Wilson.

Morgan Stanley is recommending a “combination of defensive and reasonably priced quality stocks” as investors likely face weaker corporate earnings growth this year. Specifically, it is holding an “overweight” position on traditional safe-play sectors including utilities and consumer staples. And even those sectors aren’t immune to selling this week — utilities are down as investors flock to bonds as their safe haven of choice and consumer staples have dropped as food companies face higher costs due to a surge in crop prices.

Analysts are mixed on both the short-term and long-term forecasts for the overall market.

June is often a tough month for stocks, with the S&P 500 remaining flat, on average, going back to the 1940s, according to Sam Stovall, chief investment strategist of U.S. equity strategy at CFRA. But, the sharp gains for the year followed by a slump in May could actually mean a rebound in June. He noted that the market has a pattern, going back to World War II, of digesting sharp year-to-date gains in May and then moving higher again in June.

“History warned us about a slump in May following such as strong start to the year,” he wrote in a note to investors. “History now advises us to be on the alert for a favorable follow through in June.”

© The Associated Press. All rights reserved.