Evelyn Cheng

CNBC

Investors are fleeing U.S. stocks in a way they haven't since 2004.

For 10 straight weeks a total of $30 billion has left U.S. stocks, marking the longest streak of outflows since 2004, Bank of America Merrill Lynch said in a Thursday report, citing EPFR Global data.

Investors turned instead to emerging markets and European and Japanese stocks, which saw $36 billion in inflows over the last 10 weeks, the report said.

BofAML's breakdown of last week's fund flows pointed to more aversion to risk among investors, and could add to some analysts' worries about deteriorating market internals.

The 10-week outflow from U.S. stocks comes despite the S&P 500's nearly 1 percent gain this quarter and a record high on Aug. 8.

The report also pointed out the turn away from U.S. stocks coincided with the late June surge in the euro against the U.S. dollar to its strongest in nearly a year, after comments from European Central Bank President Mario Draghi suggested higher inflation and tighter monetary policy soon in the euro zone.

The euro subsequently climbed to its highest in more than two years in early August, and traded slightly below those levels near $1.186 Friday. Draghi is scheduled to speak later Friday afternoon at an annual meeting of central bankers in Jackson Hole, Wyoming.

In the week ended Wednesday, European stocks saw their first outflows in seven weeks, the BofAML report said, while Japanese stocks saw their largest inflow in five months at $3.1 billion.

Major contributors to U.S. stock market gains in the last several months saw significant outflows in the week ended Wednesday, the BofAML report said:

Technology — $600 million, largest in 49 weeks.

Financials — $35 million, second straight week.

Consumer — $1.5 billion, third largest ever

The defensive utilities sector was the only U.S. stock sector to see slight inflows in the last week.

By investing style, investors withdrew $1.6 billion from U.S. growth stock funds and $1.1 billion from U.S. value stock funds, the BofAML report said. Only U.S. small caps saw inflows, at $700 million.

More:Antsy investors: Gold regains glitter amid rising market angst

More:Trump shutdown threat, ratings-downgrade fears rattle stocks

More:Waiting for stocks to get cheaper? Don't wait too long, pros say

More:Investors’ angst: Puny gains for small stocks

Investors also piled into Treasury bonds, which saw their greatest inflows in 10 weeks at $900 billion. But riskier high-yield debt posted $2.2 billion in outflows, its eighth week out of 10 of withdrawals, the report said.

That said, analysts don't expect the defensive turn to result in a large market downturn.

"This is definitely weaker U.S. equity inflows but still net positive and my sense is that positioning is still long and the VIX back at 11 shows there is still complacency," Ilya Feygin, managing director and senior strategist at WallachBeth Capital, said Friday. He estimated U.S. stock exchange-traded funds, passive investment products which have risen in popularity over mutual funds, gained $6.1 billion in net inflows since June 30.

In addition, BofAML said its proprietary Bull & Bear indicator did not trigger a "sell" signal, meaning the market still remains in a rally mode.

And while overall the bank's wealthy private clients turned more defensive, their allocation to one traditional safe haven, precious metals ETFs, has fallen to record lows, BofAML said.