Canada’s two largest banks are defying cooling housing markets in the country by posting solid growth in home loans.

Royal Bank of Canada, the nation’s largest mortgage lender, reported Thursday that its domestic mortgage book expanded 5.2% in the fiscal second quarter from a year earlier, while Toronto-Dominion Bank’s mortgages and amortizing home-equity lines had a 5.8% increase. Both banks reported earnings that beat analysts’ expectations.

The two lenders are bucking the trend for the overall industry, which saw year-over-year mortgage growth slide to a 17-year low of 3.2% in March, according to the Bank of Canada. Canada’s mortgage-industry slowdown has been spurred partly by government efforts to calm housing markets, particularly in Toronto and Vancouver. Tougher lending criteria introduced last year and record-high household debt have also had an impact.

“It does appear they’re being more aggressive than peers,” Jim Shanahan, an analyst of Edward Jones, said of Royal Bank and Toronto-Dominion. “Although their growth is in excess of the industry average, the industry growth rate is pretty depressed right now.”

The two banks’ mortgage-book growth contrasts with a 1% contraction reported Wednesday by Canadian Imperial Bank of Commerce, a lender that two years ago had industry-leading growth of 12%. CIBC executive Christina Kramer, who oversees Canadian personal and small business banking, said on a conference call that a market pullback in urban domestic mortgages has been more pronounced and prolonged than previously expected, and heightened competition has added to the challenges.

If those conditions persist, Kramer said, it may take CIBC longer to return to matching the industry’s growth rate.

“The cooling markets remain healthy for Canadians, and therefore for us,” Toronto-Dominion Bank Chief Financial Officer Riaz Ahmed said Thursday in a phone interview. “During bad times or good times we underwrite the same way, and what that means is that when markets slow down we tend to continue to gain very solid market share.”

Royal Bank CFO Rod Bolger said that the bank believes its mortgage growth is sustainable.

“Canadians have a strong desire to be homeowners,” he said in an interview. “The spring market has been relatively strong across the country, and we’re seeing growth across the country.”

Despite the mortgage expansion, Royal Bank’s Canadian personal-and-commercial banking division had its slowest quarter for growth in the past year, with a 2.4% increase in earnings from the year earlier. Growth in the division, the bank’s largest, was eclipsed by 17% jump in capital markets earnings, to a record, and an 8.9% increase in wealth management.

At Toronto-Dominion, the Canadian personal-and-commercial business rose 4.2%, while the U.S. retail segment, which includes contributions from U.S. discount brokerage TD Ameritrade, surged 29% from a year earlier.

Both Toronto-based lenders set aside more money for soured loans in the quarter than they did a year earlier, though the provision for credit losses was down from the first quarter. Royal Bank’s provision for credit losses climbed 55% from a year earlier, while Toronto-Dominion’s rose 14%.

“There is some normalization of [loss provisions] occurring, but not really in any significant way, and delinquencies and charge-offs continue to be very stable,” Ahmed said in the interview. Canada’s economy has been outperforming expectations for two years and job growth remains strong, he said. “I don’t think there’s anything on the horizon that would indicate that there’s an uptick trend of credit losses coming.”