When the defendant, at the time the action is commenced, is a person of unsound mind, and no guardian or conservator has been appointed, the court shall appoint a guardian for the defendant for the purposes of the action. If during the pendency of an action either party becomes or proves to be of unsound mind, the action may be prosecuted or defended by the party's guardian or conservator in like manner as if it had been commenced after the appointment of the guardian or conservator, or the court may appoint a guardian for the action as the case may require. Such guardian for the action may be appointed upon the application of any party thereto or any relative or friend of the person of unsound mind after at least five days' notice of such application first has been given to such person personally, if a resident of this state, and if not a resident, in such manner as the court shall direct. Upon the hearing of such application, the court, if deemed desirable and practicable, may order such person of unsound mind to appear personally or to be brought in by the sheriff.
N.D.C.C. § 28-03-04