Home Capital Group Inc. seems to have dodged a bullet that many feared could be the first crack in the Canadian mortgage and real estate market, which has been described as a bubble ready to burst.

Home Capital announced today that it has secured a commitment from a lender to provide them with a $2 billion line of credit in the face of a dangerous decline in deposits at their banking subsidiary, Home Trust. The deposits at Home Trust are a source of capital for mortgages, a primary business, so any drop in deposits limits their ability to lend to home buyers.

Shares of Home Capital dropped nearly 65% on Wednesday as depositers bolted in something of a run on the bank this week, with deposits declining from $1.4 billion down to just $814 million.

Bloomberg reports that the lender behind the line of credit is the Healthcare of Ontario Pension Plan (HOOPP), whose CEO sits on Home Capital’s board and is a shareholder. While Home Capital did not confirm the identity of the lender, they did advise that the terms of the loan will cause them to miss their financial targets. According to DBRS Ltd., the $2 billion loan has an initial interest rate of 10% and a $100 million setup fee.

News of the line of credit caused shares to rally and close at $8.02 on Thursday, up 33% from Wednesday but still down significantly from the $17.09 trading price on Tuesday.

Home Trust is known as an “alternative mortgage” provider, which means they provide mortgages at higher interest rates to borrowers with poor credit, and in fact they are Canada’s largest provider of such mortgages. Their current travails have caused other alternative mortgage providers in Canada to be downgraded on Thursday. For example, Jaeme Gloyn, an analyst at National Bank of Canada Financial Markets, issued the following note to clients on Thursday: “The combination of rapid deposit redemptions and the now elevated cost to replace said deposits has caused us to change how we view the world of alternative mortgage lending. As a result, we are downgrading Equitable Group to Underperform from Outperform and Street Capital Group to Sector Perform from Outperform.”

Shares of Equitable Group and Street Capital Group and other lenders were off over the past two days.

To compound the challenges facing Home Capital, they hold roughly $13 billion in fixed GIC deposits. As they mature at the rate of approximately $600 million per month, there is risk that they will not be able to replace these deposits, which could further undermine their ability to provide mortgages.

Home Capital also indicated on Thursday that the group is exploring “strategic options”, which is commonly used code for exploring the sale of the company.

How these events will impact Canadian real estate markets remains to be seen, but it is logical that the market will probably cool if fewer people have access to mortgages.