A selloff in technology shares weighed heavily on the Nasdaq, while the most recent statement from North Korea added to a cautious tone.

North Korea’s foreign minister said President Donald Trump had declared war on the country and it reserved the right to take countermeasures, including shooting down our bombers even if they are not in its airspace.

The White House disputed the declaration, calling the suggestion “absurd.”

The comments from both sides buoyed safe-haven assets, those favored in times of crisis, such as gold. And the CBOE Volatility index hit a 2-week high of 11.21.

Tech names such as Facebook, off 4.5 percent, Microsoft, down 1.55 percent, and Apple, off 0.88 percent, were among the largest drags on the benchmark S&P 500 index.

Apple shares flirted with correction territory following a report that the company had told suppliers to scale back shipments of parts for its upcoming iPhone X.

The S&P technology index fell 1.42 percent, its worst daily performance in five weeks. The index remains the best performing of the 11 major S&P sectors this year, however, with a rise of nearly 23 percent.

The losses in tech were offset somewhat by a sharp climb in the energy sector, which gained 1.47 percent. The sector notched its sixteenth gain in the last 18 sessions.

Oil prices hit a more than two-year high after major producers said the global market was on its way towards rebalancing, while Turkey threatened to cut oil flows from Iraq’s Kurdistan region toward its ports.

Genuine Parts rose 5.96 percent as the best performer on the S&P 500 after the car parts distributor said it would enter the European market with a deal to buy peer Alliance Automotive Group for about $2 billion.

Allergan was up 3.40 percent after it authorized a $2 billion buyback of its shares.

Approximately 6.42 billion shares changed hands on the major domestic equity exchanges, a number that was above the 6.02 billion share daily average over the last 20 sessions.