If it is alleged in the complaint and established by evidence, or if it appears by the evidence without such allegation in the complaint, to the satisfaction of the court, that the property, or any part of it, is so situated that partition cannot be made without great prejudice to the owners, the court may order a sale thereof. Otherwise, upon the making of requisite proof, it must order a partition according to the respective rights of the parties as ascertained by the court and appoint three referees therefor, and must designate the portion to remain undivided for the owners whose interests remain unknown or unascertained.
N.D.C.C. § 32-16-12