U.S. stocks slumped in the final minutes of trading Friday and ended a rough week with more losses. Bad news from sporting goods retailers weighed on the market.

A day before, stocks had taken their biggest loss in three months. They opened lower after retailers Foot Locker and Hibbett Sports gave dour quarterly reports. The losses eased and stocks briefly turned higher following reports that President Donald Trump’s chief strategist, Steve Bannon, left his White House post. Investors felt that makes it a bit more likely the administration can achieve at least some of its pro-business agenda.

advertisement | advertise on newsday

Major stock indexes are at their lowest levels since early July as investors respond to tensions between the U.S. and North Korea, two terrorist in Spain on Thursday, and mounting challenges to the Trump agenda of tax cuts, infrastructure spending and reduced regulation. But the Standard & Poor’s 500 index is only 2.2 percent below the record high it set earlier this month.

“There is a tremendous amount of optimism that is supporting the market even in the face of extraordinary stress,” said Brad McMillan, chief investment officer at Commonwealth Financial Network.

The S&P 500 lost 4.46 points, or 0.2 percent, to 2,425.55. The Dow Jones industrial average fell 76.22 points, or 0.3 percent, to 21,674.51. The Nasdaq composite shed 5.39 points, or 0.1 percent, to 6,216.53.