By Trevor Hunnicutt

NEW YORK (Reuters) - U.S. fund investors pulled out of riskier markets over the last week, data from Lipper showed on Thursday, as they braced for a British vote on its European Union membership even as stocks rallied.

Investors pulled $6.1 billion from U.S.-based stock funds during the weekly period ended June 22, the data showed. That was the most pulled from the funds since the week ended May 4.

"The theme is Brexit, and people are concerned," said Tom Roseen, head of research services for Thomson Reuters Lipper.

Voting closed in the so-called "Brexit" referendum on Thursday, and early surveys pointed to voters' choosing to remain in the bloc.

The weeks before the vote brought dire predictions of economic fallout if Britain decides to leave.

Yet those fears eased in the days before the vote as polls suggested a remain vote might triumph.

U.S. fund investors fled stocks as MSCI's 46-country All World index recorded five straight days of gains.

In the latest week, investors pulled $1.8 billion from U.S.-based stock mutual funds and withdrew $4.3 billion from stock ETFs, according to Lipper data.

Similarly, U.S.-based funds invested in European stocks posted $857 million in outflows during the week, their third straight week of outflows and largest since the week ended May 11. Those funds rose an average 5.3 percent during the week, Lipper performance data shows.

High-yield bond funds, which often move in tandem with stocks, recorded $766 million in outflows. And global debt funds returned $325 million in cash to investors, according to Lipper.

By contrast, precious metals funds took in $662 million and their eighth straight week of inflows, Lipper said.

"Investors have been trying to find places to hide," said Roseen.

Taxable-bond funds in the United States attracted $2.5 billion during the same period, reversing outflows from the week prior. Relatively safe money-market funds took in $1.2 billion, the research service said.

Roseen said the withdrawals leave money on the sidelines that could be redeployed in stocks in the coming weeks.

For now, Michel Del Buono, global strategist at Makena Capital Management, which oversees $20 billion of assets, said investor aversion to risk in recent weeks stems from "uncertainty and worries" about slowing growth, particularly "a China meltdown."

(Reporting by Trevor Hunnicutt; editing by Jennifer Ablan, Bernard Orr)