Stocks slid on Friday after a U.S. airstrike that killed a top Iranian general sparked fear of escalating hostilities in the Middle East.

Benchmark indexes fell, while oil prices surged. Investors also sought refuge in other assets that serve as safe havens in periods of uncertainty, including gold and the yen.

"A big fat dollop of geopolitical uncertainty has landed on investors desks," said Jeffrey Halley of Oanda in a report.

Get Breaking News Delivered to Your Inbox

The S&P 500 fell 23 points, or 0.7%, to close at 3,235, while the Dow and tech-heavy Nasdaq both lost 0.8%. The declines followed a bullish start to the new year for stocks and blockbuster gains in 2019.

News of the death of Gen. Qassem Soleimani prompted expectations of Iranian retaliation against U.S. and Israeli targets in the Middle East. Although investors don't appear to be panicking, they're turning cautious in wake of the attack, analysts said.

"Significant event"

A key source of uncertainty — what Iran might do now. In the past, the U.S. has blamed Iran for attacks on tankers and a September assault on Saudi Arabia's oil industry that temporarily cut its production by half. Wall Street analysts speculated that oil prices would be the most affected, but that a broader escalation would be a drag on stock markets overall.

"We ... would urge investors to frame this event not as another one-off military action that will fade from the news cycle, but as a significant event in the US-Iranian relationship that will alter the Middle East substantially," Height analyst Clayton Allen told investors.

"[E]xpect defensive stocks to outperform, with downward pressure on Treasury yields and gains for safe-haven currencies, until Iran's response becomes clear," Ian Shepherdson, chief economist at Pantheon Macroeconomics, wrote in a note.

Stock markets in Asia and Europe also declined.