Is It Permissible to Purchase Housing with a Mortgage?

Concluding credit agreements with financial organizations on an interest basis is haram. However, there are situations of extreme necessity. What do scholars say about mortgage lending in such cases?