The owner of an instrument which is lost, whether by destruction, theft or otherwise, may maintain an action in his own name and recover from any party liable thereon upon due proof of his ownership, the facts which prevent his production of the instrument and its terms. The court shall require security, in an amount fixed by the court not less than twice the amount allegedly unpaid on the instrument, indemnifying the defendant, his heirs, personal representatives, successors and assigns against loss, including costs and expenses, by reason of further claims on the instrument, but this provision does not apply where an action is prosecuted or defended by the state or by a public officer in its behalf.