It said it was not yet sure of the size of the effect of the poor weather and the extra June bank holiday.

This means that these figures, which are the first estimate for what happened in the economy between April and June, are more uncertain than usual.

"The bottom line from all this is that the underlying performance of the economy was probably somewhat better than the headline figure of -0.7% would suggest, having regard to the extra bank holiday and to the poor weather," said Joe Grice from the ONS.

"How much that effect might be is something we won't be able to say or to quantify until we have further experience against which to judge."

The figures could be revised in the coming months as more information comes in. The first estimate is largely based on information the first two months of the three-month period.

Prime Minister David Cameron said the figures were disappointing: "They show the extent of the economic difficulties that we're grappling with, not least the situation right across the eurozone where our neighbours are also really struggling.

"Clearly we've got to keep doing everything we can to get out of this difficult situation and provide the growth and jobs that our people and our economy needs."

Chancellor George Osborne said the country faced "big challenges".

"But given what's happening in the world, we need a relentless focus on the economy and recent announcements on infrastructure and lending show that's exactly what we're doing," he said.

If the figures are correct, this would be by some measure the worst four-year period for the UK, outside wartime, in at least 100 years - worse than what happened in the 1920s and 1930s, and worse than anything in the 1970s and 1980s

"If these figures don't make the chancellor wake up and change course, then I don't know what will," he said.

"Thank goodness the Olympics will give our economy a much-needed shot in the arm. But this short-term boost is not enough - we need a plan B now to get the economy moving again and radical reforms to set Britain on a new course for jobs, growth and long-term prosperity."

The ONS did point to some more positive signs for the economy. Employment is growing "modestly", it said, with 181,000 jobs created in the past three months.

With prices rising at a slower rate, the squeeze is also easing on household incomes.

However the output of the economy is still 4.5% lower than it was during its peak before the onset of the financial crisis in 2008.

Construction slump

Analysis

By Hugh PymChief economics correspondent, BBC News

What a muddle. On the face of it economic output has tumbled by much more than expected In the second quarter this year.

But the ONS has admitted there is a lot more uncertainty than usual because of the bad weather and the extra bank holiday.

Output is falling, yet jobs are being created in the economy, as last week's labour market data demonstrated. The business organisation the CBI says it thinks the economy is flat rather than negative.

What's really going on? We can say with certainty that the UK economy is not in a good place. As to what really happened between April and June, we may have to wait another year or more till all the revisions have taken place.

Output in the building sector fell 5.2% in the second quarter compared with the first. It is continuing to feel the effects of the economic slowdown and a sharp drop in public spending on social housing and infrastructure projects.

The ONS said the end of major Olympics projects could also be having an effect.

"This is a disaster for UK growth," said Alan Clarke, economist at Scotiabank.

"It looks like construction has done a lot of the damage," he said. "On average for the year, it's looking very unlikely that we'll be on the right side of zero growth. More likely we'll be contracting."

Production industries, which include manufacturing, decreased by 1.3%, due in part to weak demand from the eurozone, one of the UK's biggest trading partners.

The fall in services output by 0.1% surprised some, including RBS economist Ross Walker, who said he had expected the retail sector to grow during the quarter.

"We thought even with the drag from the Jubilee that we would probably just about squeeze some growth out of that sector, [but] it's contracted."

However, John Longworth, director general of the British Chambers of Commerce, said many firms were faring better than the statistics suggested.

"We're not completely convinced about the accuracy of the figures," he said. "Our business surveys and other business surveys and also the employment figures all belie what the ONS are saying about GDP and it wouldn't be the first time in history that two successive quarters have been revised upwards from negative to positive."

But he added: "Nonetheless, there's no question that the economy is, at best, stagnating."

An economy is considered to be in recession when its output has declined for two consecutive three-month periods.

The UK economy is in a double-dip recession as after a period of recession, it briefly starting growing again before a second bout of falls.

Earlier this month, the International Monetary Fund said that the UK faced "significant challenges" from a stalling recovery, high unemployment and threats from the eurozone.