In all cases of adverse claims or disputes arising out of conflicting claims to lands or concerning boundary lines, the adverse claimants may submit the decision thereof to the council of such city or town by an agreement in writing specifying particularly the subject matter in dispute, and may agree that their decision shall be final. The council must hear the proofs, and shall order a deed to be executed or denied in accordance with the facts; but in all other cases of adverse claims, the party out of possession shall commence his or her action in a court of competent jurisdiction within six months after the time of filing of the patent from the United States (or a certified copy thereof), in the office of the county auditor. In case such action be commenced, the plaintiff must serve a notice of lis pendens upon the mayor, who must thereupon stay all proceedings in the matter of granting any deed to the land in dispute until the final decision in such suit; and upon presentation of a certified copy of the final judgment of such court in such action, the council must cause to be executed and delivered a deed of such premises, in accordance with the judgment, adjudging the claimant to have been an occupant of any particular lot or lots at the time of the entry of such townsite in the United States land office, or to be the successor in interest of such occupant. If in any action brought under this chapter, or under said acts of congress, the right to the ground in controversy shall not be established by either party, the court or jury shall so find and judgment shall be entered accordingly. In such case costs shall not be allowed to either party, and neither party shall be entitled to a deed to the ground in controversy, and in such action it shall be incumbent upon each claimant to establish that he, she, or it was an occupant of the ground in controversy within the meaning of the said acts of congress at the time of the entry of said townsite in the United States land office, or is the successor in interest of such occupant.