TORONTO -- CIBC and TD Bank both saw their first-quarter earnings grow despite the fact that oilpatch woes, volatile stock markets and the sluggish economy have created a challenging environment for Canadian banks.

TD (TSX:TD) reported net income of $2.22 billion, up roughly eight per cent from a year ago when it reported $2.06 billion in quarterly profits.

Meanwhile, CIBC (TSX:CM) saw its quarterly profit climb six per cent to $982 million, from $923 million previously.

"We achieved very strong results this quarter during a period of greater market uncertainty and volatility -- conditions that may persist for the near to medium term, particularly as weak energy prices continue to be a drag on economic growth both in our own country here in Canada and globally," CIBC's chief executive Victor Dodig said during a conference call Thursday to discuss the bank's results.

"But whatever market conditions we encounter, the collective focus of our CIBC team members will remain on the following: to sustain and build on our current financial strength, to simplify and transform the way banking is done for our clients, and to deliver innovative and sustainable growth for our shareholders."

Scotiabank analyst Sumit Malhotra said the banks' efforts to keep a firm grip on their expenses allowed them to grow their earnings in spite of all the headwinds.

"In the environment we're in, expense control for all of these companies is a bigger part of the equation than it would be in a more robust operating environment," Malhotra said.

"You're seeing some of the fruits of the restructuring efforts start to make their way into the operating performance of the banks."

CIBC and TD have both taken restructuring charges in recent quarters as they looked to improve efficiency through a variety of measures, including revamping certain processes, closing branches and trimming their headcounts.

In the first quarter, CIBC had 43,609 full-time staff -- 592 fewer than it had during the previous quarter.

TD, meanwhile, had 79,927 full-time employees in the first quarter, down 627 from the prior quarter. Compared to a year ago, the bank has slimmed down its ranks by 2,256 workers.