Stocks on Wall Street surrendered early gains and closed broadly lower Friday after the White House said President Donald Trump would impose promised tariffs on key U.S. trading partners.

The S&P 500 fell 0.5% and the Nasdaq composite dropped 0.3%. The indexes, which had posted solid gains in morning trading, posted their first weekly loss in three weeks. The Dow Jones industrial average fell 0.8%.

Trump will put in place 25% tariffs on imports from Canada and Mexico and 10% tariffs on goods from China effective Saturday. The White House provided no word on whether there would be any exemptions to the measures that could result in swift price increases to U.S. consumers.

The selling was broad, with about 75% of the stocks in the S&P 500 closing lower. Technology and energy companies accounted for a large share of the decline.

Apple reversed course from market leading gains to a loss of 0.7%. The company had reported stronger profit for the latest quarter than analysts expected. Wall Street’s most valuable company, and thus the most influential on the S&P 500 and other indexes, said sales of iPhones dipped.

KLA, a supplier to the electronics industry initially rose after reporting profit and revenue that topped analysts’ expectations, but then closed down 0.6%.

Shares of Nvidia, considered the poster child for the AI frenzy, fell 3.7%. They dropped 15.8% for the week.

Worries that tariffs could end up driving inflation higher helped push long-term bond yields higher, including the 10-year Treasury, which rose to 4.54% from 4.52% late Thursday.

Shorter-term U.S. government bond yields mostly fell.

Walgreens Boots Alliance dropped 10.3% after suspending its dividend and breaking a streak of quarterly payouts to its shareholders that stretches back more than 90 years.

Exxon Mobil ticked down 2.5% even though the energy giant posted a stronger fourth quarter profit than Wall Street had forecast.

All told, the S&P 500 fell 30.64 points to 6,040.53. The Dow dropped 337.47 points to 44,544.66. The Nasdaq lost 54.31 points to close at 19,627.44.

— Associated Press