In every action against a person for usurping an office, judgment shall be rendered upon the right of the defendant and also upon the right of the person alleged to be entitled to the office or only upon the right of the defendant, as justice shall require.
N.D.C.C. § 32-13-06