OTTAWA — The Canadian economy shrivelled in the second quarter to its worst performance in seven years, Statistics Canada said Wednesday.

The federal agency said real gross domestic product fell at an annualized rate of 1.6 per cent in the three-month period, due in large part to the wildfires that destroyed parts of Fort McMurray, Alta. That's the biggest quarterly decline since the second quarter of 2009 when Canada was in the midst of the global financial crisis.

The contraction reported Wednesday compared with growth at an annual pace of 2.5 per cent in the first quarter, which was revised from an initial reading of 2.4 per cent.

Economists had expected a drop of 1.5 per cent in the second quarter, according to Thomson Reuters.

"It wasn't pretty, but it wasn't expected to be,'' Avery Shenfeld of CIBC Capital Markets said in a research note.

The drop in GDP came as exports of goods and services fell 4.5 per cent in the quarter following a 1.9 per cent increase in the first three months of the year. Exports of goods were down 5.5 per cent, while exports of services grew 0.6 per cent.

Already hurting from the drop in energy prices, the Alberta wildfires dealt a blow to the energy sector, forcing the evacuation of Fort McMurray and shutdown of several oilsands operations in the region.

Worse than Bank of Canada forecast

Energy product exports fell 7.5 per cent, with crude and bitumen exports declining 9.6 per cent and refined petroleum products down a whopping 19.6 per cent. Motor vehicles and parts also dropped 5.8 per cent due to lower exports of passenger cars and light trucks.

Exports of aircraft and other transportation equipment and parts were up 5.6 per cent.

However, despite the pullback for the quarter as a whole, the economy ended the quarter with growth in June.

Statistics Canada said real GDP rose 0.6 per cent that month, boosted in part to non-conventional oil extraction as production in the Alberta oilsands region started to resume. Economists had expected a gain of 0.4 per cent for the month, according to Thomson Reuters.

Mining, quarrying and oil and gas extraction climbed 3.6 per cent in June, boosted by 12 per cent gain in non-conventional oil extraction.

"The best news was that June GDP rebounded with a brighter than expected 0.6 per cent gain, and less than half of that came from the rebound in mining/oil/gas, as manufacturing also had a healthy gain,'' Shenfeld said.

"All told, a quarter we will like to forget, and for the next few months, a more supportive Q3 will help us do just that.''

The second-quarter result reported Wednesday was worse than forecast by the Bank of Canada in its July monetary policy report. The central bank had predicted that the economy would contract at an annual rate of 1.0 per cent during the second quarter due to the damage caused by the wildfires.

But the Bank of Canada has also predicted that growth will pick up in the third quarter to an annual pace of 3.5 per cent as oil production ramps up and rebuilding efforts begin in Fort McMurray. It also expects the federal government's new Canada child benefit and a boost to infrastructure spending to lend a hand to the economy.