When the mortgagee or person claiming under him has taken possession of the mortgaged premises, and the debt secured by the mortgage is paid or released after condition broken and before foreclosure perfected, the mortgagor or person claiming under him may maintain a real action to recover possession of said premises, the same as if paid or released before condition broken.
14 M.R.S. § 6209