In any action for the foreclosure of a real estate mortgage, the court shall render judgment for the amount found to be due and the costs of the action, and shall order a sale of the premises to pay the amount adjudged to be due. The court may order delivery of the possession of the premises to the purchaser after the expiration of the redemption period unless otherwise ordered by the court pursuant to section 32-19-19. The judgment must provide that during the redemption period the debtor or owner of the premises is entitled to the possession, rents, use, and benefit of the real property sold except as provided by section 32-19-19.
N.D.C.C. § 32-19-06