(Reuters) - Canadian Imperial Bank of Commerce (>> Canadian Imperial Bank of Commerce) reported a stronger-than-expected second-quarter profit on Thursday, helped by its retail and business banking division, and raised its quarterly dividend, even as it set aside more cash for bad loans.

The stock shed 1.9 percent to C$101.38 in morning trade.

Canada’s fifth biggest lender said gross impaired loans in the oil and gas sector shot up to C$708 million ($548 million), compared with C$25 million a year ago and C$128 million in the first quarter.

The numbers highlighted the impact of the oil price crash on Canadian banks. Both Royal Bank of Canada (>> Royal Bank of Canada) and Toronto Dominion Bank (>> Toronto-Dominion Bank) reported a rise in bad loans to oil and gas firms on Thursday, a day after Bank of Montreal (>> Bank of Montreal) said bad loans to energy companies more than doubled in the second quarter.

CIBC set aside C$284 million to cover for bad loans, which is 44 percent more than a year earlier on an adjusted basis, mainly due to bigger losses in the oil and gas sector and higher write-offs in the card and personal lending portfolios.

The bank added one company to oil and gas watchlist in the quarter, Chief Risk Officer Laura Dottori-Attanasio said on a conference call with analysts.

CIBC does not expect any significant losses due to its exposure to the blazes in Fort McMurray, she added. The wildfire that has ravaged northern Alberta and hit Canadian crude oil output is expected to weigh on corporate earnings across a range of sectors.

The bank's net income for the second quarter ended April 30 rose to C$941 million, or C$2.35 per share, from C$911 million, or C$2.25 per share, a year earlier. Net income attributable to common shareholders rose to C$926 million from C$895 million.

Adjusted earnings climbed C$2.40 per share. Analysts on average expected C$2.31 per share, according to Thomson Reuters I/B/E/S.

CIBC's net income from retail and business banking division rose about 12 percent to C$652 million from a year earlier. Net income from its wealth management unit fell by about 12 percent as the company stopped recognizing revenue from American Century Investments after selling its stake in the U.S. fund manager earlier this year. Excluding the loss of ACI revenue, net income in the division was up 7 percent.

CIBC also hiked its quarterly dividend to C$1.21 per share, up 3 Canadian cents from the previous quarter.

(Reporting by Amrutha Gayathri in Bengaluru, John Tilak and Matt Scuffham in Toronto; Editing by Anupama Dwivedi, Anil D'Silva and W Simon)