Canada Mortgage and Housing Corp. said Thursday it will pay a $4 billion special dividend to the federal government.

The national housing agency said the dividend will be paid out in instalments over a period not longer than than the next two years.

"The special dividend returns excess capital to the Government of Canada while ensuring enough capital is retained for the risks we've assumed," said Wojo Zielonka, CMHC's chief financial officer, in a statement.

Since its creation in 1946, CMHC said, the agency has retained all of its net income as capital, but in the future it will consider a regular quarterly dividend to the federal government in the event its actual capital exceeds its capital target.

The agency said its earnings are already consolidated into the federal government's accounts, meaning the dividend will not impact Ottawa's projected deficit.

"CMHC's special $4 billion dividend is a sign of how well the Crown corporation is managing its mortgage loan insurance and securitization businesses," said federal finance minister Bill Morneau in a statement. "By sending excess funds to the government, CMHC is abiding by good governance principles."

The announcement of the $4 billion special dividend comes after CMHC said it would pay a dividend of $145 million to Ottawa as part of its first-quarter report at the end of May.

In that report, CMHC also said it saw a sharp decline in the number of home buyers who qualified for mortgage insurance under tougher rules implemented last fall. The agency said that it insured just over 48,000 new mortgages between January and March, a 41 per cent decline from the previous three-month period.