U.S. markets were jittery but ended mostly negative Friday, capping a turbulent week marked by a brutal losing streak and the best single day of trading in a decade.

Thursday’s wild swings mirrored the volatility that has defined December, with markets sinking nearly 3 percent, then making a last-minute turnaround to close with modest gains. On Friday, the Dow Jones industrial average was down 0.33 percent at close. The Standard & Poor’s 500-stock index was down 0.13 percent, and the tech-heavy Nasdaq composite index was up 0.08 percent. U.S. markets are up 3 percent across the board, looking to break a three-week losing streak.

After Wall Street’s recovery, overseas markets followed suit Friday despite a challenging start. With the exception of Tokyo’s Nikkei 225, which slipped 0.31 percent to 20,014.77, Asian markets logged mild gains. Hong Kong’s Hang Seng was up 0.1 percent at the close; the Shanghai Composite Index was up 0.44 percent. European markets rebounded after a grim Thursday, with the benchmark Stoxx 600 up 2 percent. Germany’s DAX up more than 1.7 percent. France’s CAC 40 was up more than 2 percent, and Britain’s FTSE 100 rose more than 2.3 percent.

December has been brutal for Wall Street, erasing gains from throughout the year and putting markets on track for annual losses, while stocks are nearing their worst December since 1931. A trade conflict with China, the Federal Reserve’s decision to hike interest rates, which drew attacks by President Trump, and a partial government shutdown have rattled investors. Since Dec. 1, the S&P 500 is down more than 10 percent. The uncertainty has dampened consumer attitudes, according to the Conference Board, a business research group, which said its consumer confidence index fell more than expected this month despite a strong labor market. Concerns about an economic slowdown have pushed consumer expectations for the future to their lowest point since November 2016.

In a shortened trading session Monday, the markets suffered their worst Christmas Eve decline in decades, with the S&P 500 ending in bear territory. As Trump renewed his attacks on the Federal Reserve, accusing it of not having a “feel for the market,” Treasury Secretary Steven Mnuchin called executives at major banks in an effort that was meant to be reassuring but that sowed more anxiety than faith.

But on Wednesday, the markets roared back to life in the best single day of trading in more than a decade, with the Dow logging its biggest one-day gain in a 1,086-point jump. Investors were steadied by assurances from White House economic adviser Kevin Hassett that Federal Reserve Chairman Jerome H. Powell’s job was “100 percent safe.” Markets surged after the announcement. Thursday brought more turbulence, however, with markets falling as much as 3 percent, then rebounding in the final hours of trading to close positive across the board.

Friday’s decline, headlined by the possibility of the partial government shutdown extending into the new year, ended the week with losses one day before the last trading day of 2018.

As Wall Street has flirted with bear territory, many analysts have wondered whether this is the beginning of an economic slowdown. The political whirlwind has destabilized the markets, bringing on a volatility that hasn’t been seen for years, said Howard Silverblatt, a senior analyst with S&P Dow Jones Indices. The violent high-low swings that have been typical of late used to be a rarity, Silverblatt said.

“We’ve had 108 days this year that have had spreads of more than 1 percent. Last year, we had 10,” Silverblatt said. “We’re not used to seeing this kind of uncertainty in the markets.”

Yet according to Ivan Feinseth, chief investment officer at Tigress Financial Partners, the big midweek turnaround is evidence that the economy is still strong despite a bevy of tensions and unknowns.

“We are reaching the end of the forced selling pressure and panic that have driven the market lower throughout the month of December,” Feinseth wrote in a note to investors Friday. “Even as a number of negative factors including the government shutdown still remain, reassuring comments from Fed Chair [Jerome] Powell and positive movement on U.S.-China trade talks are starting to provide some support for the market.”