Major U.S. stock indexes gave up early gains and ended mostly lower Wednesday, extending their losses for the week.

Energy stocks led the decliners as crude oil prices fell. Technology stocks bucked the broader sector slide. Worries about economic fallout from the virus outbreak that originated in China have fueled a sharp sell-off that wiped out the market’s gains for the year.

On Wednesday:

The S&P 500 index fell 11.82 points, or 0.4%, to 3,116.39.

The Dow dropped 123.77 points, or 0.5%, to 26,957.59.

The Nasdaq gained 15.16 points, or 0.2%, to 8,980.77.

The Russell 200 index of smaller company stocks dropped 19.14 points, or 1.2%, to 1,552.76.

For the week:

The S&P 500 is down 221.36 points, or 6.6%.

The Dow is down 2,034.82 points, or 7%.

The Nasdaq is down 595.82 points, or 6.2%.

The Russell 2000 is down 125.85 points, or 7.5%.

For the year:

The S&P 500 is down 114.39 points, or 3.5%.

The Dow is down 1,580.85 points, or 5.5%.

The Nasdaq is up 8.17 points, or 0.1%.

The Russell 2000 is down 115.71 points, or 6.9%.