By Joseph Nasr

BERLIN (Reuters) - German business morale fell only slightly in July, a benchmark survey showed, suggesting Europe's largest economy has weathered the immediate storm from Britain's vote to leave the European Union.

But fallout from Brexit, as well as strains to the social fabric caused by four high-profile acts of violence on German soil in the past week, could take their toll on sentiment in coming months, economists said.

The Munich-based Ifo economic institute said on Monday its business climate index, based on a monthly survey of some 7,000 firms, fell to 108.3 in July from 108.7 in June.

The headline figure beat the Reuters consensus forecast of 107.5 and was the second highest reading this year. But it also marked the first fall in three months.

"This was due to far less optimistic business expectations on the part of companies. Assessments of the current business situation, by contrast, improved slightly," Ifo chief Clemens Fuest said, adding: "The German economy proves resilient."

Sentiment in manufacturing, trade and industry and wholesaling fell, while retailing and construction improved.

Some German companies are holding off making investments in Britain until they know more about the relationship the country will forge with the rest of Europe following the Brexit vote.

MIXED PICTURE

A similarly mixed picture emerged from soundings on what the Ifo numbers said about the impact of the June 23 referendum.

VP Bank Group economist Thomas Gitzel said German firms were reacting relatively calmly. "It could have been far worse. The Ifo index proves the theory that the Brexit vote will not leave deep dampening effects on the German economy," he said.

Ifo economist Klaus Wohlrabe said Brexit was likely to cost the German economy 0.1 percentage points of GDP growth in 2016.

The institute now expects a 1.7 percent expansion this year and stuck to its forecast of 1.6 percent in 2017.

ING economist Carsten Brzeski said fallout from Britain's 'Leave' vote was likely to dampen the Ifo index in the coming months.

"It would not be the first time that the Ifo reacts with a delay of one or two months to global events. Therefore, it is in our view too early to regard the Brexit vote as a non-event for economic sentiment in Germany," Brzeski said.

He also cited the "alarming" reality of four violent attacks in southern Germany in the past week that could significantly change the political mood a year before a federal election.

Wohlrabe said the attacks -- in the latest of which on Sunday evening a Syrian man denied asylum blew himself up and wounded 12 others -- could also dent economic sentiment in the near term.

"(But) a feeling of uncertainty caused by Brexit and other things can only be seen in some sectors," he added.

(Additional reporting by Joern Poltz, Michelle Martin and Caroline Copley; Editing by Paul Carrel and John Stonestreet)