PARIS - French consumer confidence picked up in August, shrugging off two Islamist militant attacks the month before and Britain's shock vote to leave the EU, data showed on Friday, a sign the French economy started the third quarter on a stronger footing.

The brighter outlook among consumers, France's traditional growth engine, will reassure the government after official data confirmed the euro zone's second-largest economy ground to a halt in the second quarter.

Coming after brisk growth in the first quarter, the surprise stagnation in April-June was brought about by caution among companies, which drew down their inventories and cut investments, and consumers, who put a brake on spending, in a quarter marked by violent street protests, strikes and floods.

But despite bloody attacks in Nice and Normandy, which took place after the previous consumer confidence poll, and the fallout of Britain's Brexit referendum, this month's survey provided more positive clues about the current quarter.

French households' opinion about their personal financial situation improved markedly, INSEE said, gaining 7 points to reach the highest level since October 2007.

French consumers, whose high saving rate has frustrated the government's hopes to see them boost spending, also reported to pollsters that their saving capacity had improved but that now was a less opportune time to save.

That is good news for President Francois Hollande's government, which is currently preparing next year's budget bill and mulling whether growth in future quarters will be strong enough to cut taxes less than a year before a presidential election.

The brighter outlook was not limited to France, with consumers' mood also improving unexpectedly in Germany as sentiment hit one of the highest levels in the past 15 years, a survey showed on Friday.

In France, there were also positive signs on the business front, with companies' margins rising to 32.2 percent in the first quarter, the statistics office said separately, the highest level since the fourth quarter of 2008, when the global financial crisis erupted.

The Socialist government, concerned at the loss of competitiveness of French firms, launched a 40 billion euro tax cut plan in 2014 to shore up depressed business margins.