In every such case judgment may be rendered upon the right of the defendant, and also upon the right of the party so alleged to be entitled, or only upon the right of the defendant, as the form of the action and justice may require.
Idaho Code § 6-604