Stocks closed broadly lower on Wall Street Thursday, extending the market’s slide into a fourth straight day, as investors braced for a possible escalation in the trade war between the U.S. and China.

Tensions between the world’s two largest economies dragged stocks lower ahead of a Friday deadline when the United States said it would impose more tariffs on Chinese goods. The worries about trade this week have halted what has been the hottest start to a year for U.S. stocks in decades, and the S&P 500 index is on pace for its worst week of 2019.

Thursday’s sell-off began steep and widespread, but lost momentum by afternoon, allowing the market to stem some of its losses.

Still, analysts said the market was likely in for more pain until the uncertainty over the costly trade dispute is resolved.

“China and trade remain the biggest drag and the biggest overhang for the market,” said Ben Phillips, chief investment officer at EventShares. “If there’s not a deal within the next four to six weeks, the market is going to continue to be under pressure and sell off.”

The S&P 500 fell 8.70 points, or 0.3%, to 2,870.72. The benchmark index has essentially given back all its April gains, though it’s still up 14.5% for the year.

The Dow Jones Industrial Average dropped 138.97 points, or 0.5%, to 25,828.36. It was down nearly 450 points in morning trading before regaining much of the ground it lost.

The Nasdaq composite slid 32.73 points, or 0.4%, to 7,910.59. The Russell 2000 index of small company stocks gave up 4.92 points, or 0.3%, to 1,570.06.

Major indexes in Europe and Asia also finished lower.

Bond prices didn’t move much. The yield on the 10-year Treasury note held steady at 2.45%.

The U.S. government has filed plans to raise tariffs on $200 billion worth of Chinese imports from 10% to 25%. The Trump administration has also threatened to extend 25% tariffs to another $325 billion in Chinese imports, covering everything China ships to the United States.

If the increases take effect as planned, Beijing will impose “necessary countermeasures,” the Commerce Ministry said. It gave no details, but a ministry spokesman said Beijing has made “all necessary preparations,” suggesting it might be bracing for a worsening conflict.

Such moves would mark a sharp escalation in the trade dispute that has raised prices on goods for consumers and companies.

Technology stocks were among the big decliners, as many companies in the sector get much of their revenue from China. The sector slid 0.7%.

Raw material producers also took heavy losses. Real estate stocks, which investors see as a safe-play sector, eked out a slight gain.

Occidental Petroleum tumbled 6.4% after Chevron pulled out of a potential bidding war with the company to buy Anadarko. Energy companies also fell with the price of oil, as benchmark U.S. crude dropped 0.7% to settle at $61.70 per barrel. Brent crude, the international standard, closed essentially flat at $70.39 per barrel.

Investors bid up shares in Tapestry after the maker of Kate Spade and Coach handbags beat first quarter profit forecasts and announced a $1 billion stock buyback plan. The stock vaulted 8.5%, the biggest gainer in the S&P 500.

The trade war between Washington and Beijing is nothing new. The U.S. and China have already raised tariffs on tens of billions of dollars of each other’s goods in their dispute over U.S. complaints about Beijing’s industrial and technology policies and a perennial U.S. deficit in trade with China.

But earlier this year, investors were growing increasingly confident that the two sides would eventually find a deal on trade. That helped to calm markets following a tumultuous end to 2018, and the S&P 500 rallied back to a record despite the trade dispute.

A more patient Federal Reserve, which said it may not raise interest rates at all this year, also helped to clear worries about a possible recession, and the S&P 500 vaulted 17.5% higher in the first four months of the year.

But the calm shattered earlier this week after the United States set the Friday deadline for adding more tariffs.

“We need to be prepared for continuing uncertainty in the trade war,” said Kristina Hooper, chief global market strategist at Invesco.

Investors prematurely priced a resolution into the markets, she said, and now it’s likely the additional tariffs will be applied. She said investors still want to believe that a positive resolution is possible and any progress in the negotiations now could “create something of a rally or certainly help stabilize stocks.”