If it appears to the court, by the certificate of the recorder, or the clerk of the district court, or by the verified statement of any person who may have examined or searched the records, that there are outstanding liens or encumbrances of record upon the real property, or any part or portion thereof, which existed and were of record at the time of the commencement of the action, and the persons holding such liens are not made parties to the action, the court either must order such persons to be made parties to the action by an amended or supplemental complaint, or must appoint a referee to ascertain whether or not such liens or encumbrances have been paid, or, if not paid, what amount remains due thereon, and their order among the liens or encumbrances severally held by such persons and the parties to the action, and whether the amount remaining due thereon has been secured in any manner and, if secured, the nature and extent of the security.
N.D.C.C. § 32-16-10