A legal procedure whereby property used as security for a debt is sold to satisfy the debt in the event of default in payment of the mortgage note or default of other terms in the mortgage document. The foreclosure procedure brings the rights of all parties to a conclusion and passes the title in the mortgaged property to either the holder of the mortgage or a third party who may purchase the realty at the foreclosure sale, free of all encumbrances affecting the property subsequent to the mortgage.